Skip to content

Commit 86b0f8b

Browse files
committed
upd
1 parent 94b1f41 commit 86b0f8b

File tree

1 file changed

+18
-2
lines changed
  • x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan

1 file changed

+18
-2
lines changed

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,26 @@ private static Object doTransformExpression(Object arg, Function<Expression, ? e
156156
transformed.set(i, next);
157157
}
158158
}
159-
159+
return hasChanged ? transformed : arg;
160+
} else if (arg instanceof Collection<?> c) {
161+
List<Object> transformed = null;
162+
boolean hasChanged = false;
163+
int i = 0;
164+
for (Object e : c) {
165+
Object next = doTransformExpression(e, traversal);
166+
if (e.equals(next) == false) {
167+
if (hasChanged == false) {
168+
hasChanged = true;
169+
// TODO if collection is a set then this silently changes its semantics by allowing duplicates
170+
// We should fix it or confirm this branch is never needed
171+
transformed = new ArrayList<>(c);
172+
}
173+
transformed.set(i, next);
174+
}
175+
i++;
176+
}
160177
return hasChanged ? transformed : arg;
161178
}
162-
assert arg instanceof Collection<?> == false : "Non-List Collection implementations are not supported";
163179

164180
return arg;
165181
}

0 commit comments

Comments
 (0)