Skip to content

Commit fd60bfb

Browse files
ES|QL: Ensure minimum capacity for PlanStreamInput caches (#114116) (#114131)
Co-authored-by: Elastic Machine <[email protected]>
1 parent 46e6420 commit fd60bfb

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

docs/changelog/114116.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 114116
2+
summary: "ES|QL: Ensure minimum capacity for `PlanStreamInput` caches"
3+
area: ES|QL
4+
type: bug
5+
issues: []

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/io/stream/PlanStreamInput.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ private Attribute attributeFromCache(int id) throws IOException {
209209
private void cacheAttribute(int id, Attribute attr) {
210210
assert id >= 0;
211211
if (id >= attributesCache.length) {
212-
attributesCache = ArrayUtil.grow(attributesCache);
212+
attributesCache = ArrayUtil.grow(attributesCache, id + 1);
213213
}
214214
attributesCache[id] = attr;
215215
}
@@ -252,7 +252,7 @@ private EsField esFieldFromCache(int id) throws IOException {
252252
private void cacheEsField(int id, EsField field) {
253253
assert id >= 0;
254254
if (id >= esFieldsCache.length) {
255-
esFieldsCache = ArrayUtil.grow(esFieldsCache);
255+
esFieldsCache = ArrayUtil.grow(esFieldsCache, id + 1);
256256
}
257257
esFieldsCache[id] = field;
258258
}

0 commit comments

Comments
 (0)