Skip to content

Commit aab293b

Browse files
ES|QL: Make ResolveUnionTypes rule stateless (#136492) (#136521)
1 parent 2041c7b commit aab293b

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

docs/changelog/136492.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 136492
2+
summary: Make `ResolveUnionTypes` rule stateless
3+
area: ES|QL
4+
type: bug
5+
issues: []

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/analysis/Analyzer.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,15 +1853,13 @@ private static class ResolveUnionTypes extends Rule<LogicalPlan, LogicalPlan> {
18531853

18541854
record TypeResolutionKey(String fieldName, DataType fieldType) {}
18551855

1856-
private List<FieldAttribute> unionFieldAttributes;
1857-
18581856
@Override
18591857
public LogicalPlan apply(LogicalPlan plan) {
1860-
unionFieldAttributes = new ArrayList<>();
1861-
return plan.transformUp(LogicalPlan.class, p -> p.childrenResolved() == false ? p : doRule(p));
1858+
List<FieldAttribute> unionFieldAttributes = new ArrayList<>();
1859+
return plan.transformUp(LogicalPlan.class, p -> p.childrenResolved() == false ? p : doRule(p, unionFieldAttributes));
18621860
}
18631861

1864-
private LogicalPlan doRule(LogicalPlan plan) {
1862+
private LogicalPlan doRule(LogicalPlan plan, List<FieldAttribute> unionFieldAttributes) {
18651863
Holder<Integer> alreadyAddedUnionFieldAttributes = new Holder<>(unionFieldAttributes.size());
18661864
// Collect field attributes from previous runs
18671865
if (plan instanceof EsRelation rel) {

0 commit comments

Comments
 (0)