Skip to content

Commit 5478750

Browse files
ES|QL: Ensure minimum capacity for PlanStreamInput caches (#114116) (#114132)
1 parent 03ec02c commit 5478750

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
@@ -255,7 +255,7 @@ private Attribute attributeFromCache(int id) throws IOException {
255255
private void cacheAttribute(int id, Attribute attr) {
256256
assert id >= 0;
257257
if (id >= attributesCache.length) {
258-
attributesCache = ArrayUtil.grow(attributesCache);
258+
attributesCache = ArrayUtil.grow(attributesCache, id + 1);
259259
}
260260
attributesCache[id] = attr;
261261
}
@@ -297,7 +297,7 @@ private EsField esFieldFromCache(int id) throws IOException {
297297
private void cacheEsField(int id, EsField field) {
298298
assert id >= 0;
299299
if (id >= esFieldsCache.length) {
300-
esFieldsCache = ArrayUtil.grow(esFieldsCache);
300+
esFieldsCache = ArrayUtil.grow(esFieldsCache, id + 1);
301301
}
302302
esFieldsCache[id] = field;
303303
}

0 commit comments

Comments
 (0)