Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/136492.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 136492
summary: Make `ResolveUnionTypes` rule stateless
area: ES|QL
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -1646,15 +1646,13 @@ private static class ResolveUnionTypes extends Rule<LogicalPlan, LogicalPlan> {

record TypeResolutionKey(String fieldName, DataType fieldType) {}

private List<FieldAttribute> unionFieldAttributes;

@Override
public LogicalPlan apply(LogicalPlan plan) {
unionFieldAttributes = new ArrayList<>();
return plan.transformUp(LogicalPlan.class, p -> p.childrenResolved() == false ? p : doRule(p));
List<FieldAttribute> unionFieldAttributes = new ArrayList<>();
return plan.transformUp(LogicalPlan.class, p -> p.childrenResolved() == false ? p : doRule(p, unionFieldAttributes));
}

private LogicalPlan doRule(LogicalPlan plan) {
private LogicalPlan doRule(LogicalPlan plan, List<FieldAttribute> unionFieldAttributes) {
Holder<Integer> alreadyAddedUnionFieldAttributes = new Holder<>(unionFieldAttributes.size());
// Collect field attributes from previous runs
if (plan instanceof EsRelation rel) {
Expand Down
Loading