Skip to content

Commit 62c8c10

Browse files
luigidellaquilaKubik42
authored andcommitted
ES|QL: Make ResolveUnionTypes rule stateless (elastic#136492)
1 parent 8d7fd3a commit 62c8c10

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
@@ -1845,15 +1845,13 @@ private static class ResolveUnionTypes extends Rule<LogicalPlan, LogicalPlan> {
18451845

18461846
record TypeResolutionKey(String fieldName, DataType fieldType) {}
18471847

1848-
private List<FieldAttribute> unionFieldAttributes;
1849-
18501848
@Override
18511849
public LogicalPlan apply(LogicalPlan plan) {
1852-
unionFieldAttributes = new ArrayList<>();
1853-
return plan.transformUp(LogicalPlan.class, p -> p.childrenResolved() == false ? p : doRule(p));
1850+
List<FieldAttribute> unionFieldAttributes = new ArrayList<>();
1851+
return plan.transformUp(LogicalPlan.class, p -> p.childrenResolved() == false ? p : doRule(p, unionFieldAttributes));
18541852
}
18551853

1856-
private LogicalPlan doRule(LogicalPlan plan) {
1854+
private LogicalPlan doRule(LogicalPlan plan, List<FieldAttribute> unionFieldAttributes) {
18571855
Holder<Integer> alreadyAddedUnionFieldAttributes = new Holder<>(unionFieldAttributes.size());
18581856
// Collect field attributes from previous runs
18591857
if (plan instanceof EsRelation rel) {

0 commit comments

Comments
 (0)