Skip to content

Commit 6250cde

Browse files
committed
upd
1 parent 16a15af commit 6250cde

File tree

2 files changed

+5
-3
lines changed
  • x-pack/plugin
    • esql-core/src/main/java/org/elasticsearch/xpack/esql/core/tree
    • esql/src/main/java/org/elasticsearch/xpack/esql/plan

2 files changed

+5
-3
lines changed

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/tree/Node.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public void forEachDown(Consumer<? super T> action) {
6969
action.accept((T) this);
7070
// please do not refactor it to a for-each loop
7171
// to avoid allocating iterator that performs concurrent modification checks
72-
for (int c = 0; c < children.size(); c++) {
72+
for (int c = 0, size = children.size(); c < size; c++) {
7373
children.get(c).forEachDown(action);
7474
}
7575
}
@@ -87,7 +87,7 @@ public <E extends T> void forEachDown(Class<E> typeToken, Consumer<? super E> ac
8787
public void forEachUp(Consumer<? super T> action) {
8888
// please do not refactor it to a for-each loop
8989
// to avoid allocating iterator that performs concurrent modification checks
90-
for (int c = 0; c < children.size(); c++) {
90+
for (int c = 0, size = children.size(); c < size; c++) {
9191
children.get(c).forEachUp(action);
9292
}
9393
action.accept((T) this);

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan/QueryPlan.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import java.util.ArrayList;
1717
import java.util.Collection;
1818
import java.util.List;
19+
import java.util.Set;
1920
import java.util.function.Consumer;
2021
import java.util.function.Function;
2122

@@ -145,7 +146,7 @@ private static Object doTransformExpression(Object arg, Function<Expression, ? e
145146
boolean hasChanged = false;
146147
// please do not refactor it to a for-each loop
147148
// to avoid allocating iterator that performs concurrent modification checks
148-
for (int i = 0; i < c.size(); i++) {
149+
for (int i = 0, size = c.size(); i < size; i++) {
149150
var e = c.get(i);
150151
Object next = doTransformExpression(e, traversal);
151152
if (e.equals(next) == false) {
@@ -159,6 +160,7 @@ private static Object doTransformExpression(Object arg, Function<Expression, ? e
159160

160161
return hasChanged ? transformed : arg;
161162
}
163+
assert arg instanceof Set<?> == false : "Set arguments are not supported";
162164

163165
return arg;
164166
}

0 commit comments

Comments
 (0)