Skip to content

Commit 585d4a8

Browse files
ES|QL: Make ResolveUnionTypes rule stateless (#136492) (#136520)
1 parent 43bbcb3 commit 585d4a8

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

16471647
record TypeResolutionKey(String fieldName, DataType fieldType) {}
16481648

1649-
private List<FieldAttribute> unionFieldAttributes;
1650-
16511649
@Override
16521650
public LogicalPlan apply(LogicalPlan plan) {
1653-
unionFieldAttributes = new ArrayList<>();
1654-
return plan.transformUp(LogicalPlan.class, p -> p.childrenResolved() == false ? p : doRule(p));
1651+
List<FieldAttribute> unionFieldAttributes = new ArrayList<>();
1652+
return plan.transformUp(LogicalPlan.class, p -> p.childrenResolved() == false ? p : doRule(p, unionFieldAttributes));
16551653
}
16561654

1657-
private LogicalPlan doRule(LogicalPlan plan) {
1655+
private LogicalPlan doRule(LogicalPlan plan, List<FieldAttribute> unionFieldAttributes) {
16581656
Holder<Integer> alreadyAddedUnionFieldAttributes = new Holder<>(unionFieldAttributes.size());
16591657
// Collect field attributes from previous runs
16601658
if (plan instanceof EsRelation rel) {

0 commit comments

Comments
 (0)