Skip to content

Commit 30c2295

Browse files
update according to review comments
1 parent 7cc94a5 commit 30c2295

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,9 +2277,9 @@ private static AggregateMetricDoubleBlockBuilder.Metric getMetric(AggregateFunct
22772277

22782278
/**
22792279
* Handle union types in UnionAll:
2280-
* 1. Push down explicit conversion functions into the UnionAll legs
2280+
* 1. Push down explicit conversion functions into the UnionAll branches
22812281
* 2. Replace the explicit conversion functions with the corresponding attributes in the UnionAll output
2282-
* 3. Implicitly cast the outputs of the UnionAll legs to the common type if necessary
2282+
* 3. Implicitly cast the outputs of the UnionAll branches to the common type if necessary
22832283
* 4. Update the attributes referencing the updated UnionAll output
22842284
*/
22852285
private static class ResolveUnionTypesInUnionAll extends Rule<LogicalPlan, LogicalPlan> {
@@ -2293,7 +2293,7 @@ private static class ResolveUnionTypesInUnionAll extends Rule<LogicalPlan, Logic
22932293
public LogicalPlan apply(LogicalPlan plan) {
22942294
convertFunctionsToAttributes = new HashMap<>();
22952295
updatedUnionAllOutput = new ArrayList<>();
2296-
// First push down the conversion functions into the UnionAll legs
2296+
// First push down the conversion functions into the UnionAll branches
22972297
LogicalPlan planWithConvertFunctionsPushedDown = plan.transformUp(
22982298
UnionAll.class,
22992299
unionAll -> maybePushDownConvertFunctions(unionAll, plan)
@@ -2302,7 +2302,7 @@ public LogicalPlan apply(LogicalPlan plan) {
23022302
// Then replace the conversion functions with the corresponding attributes in the UnionAll output
23032303
LogicalPlan planWithConvertFunctionsReplaced = replaceConvertFunctions(planWithConvertFunctionsPushedDown);
23042304

2305-
// Next implicitly cast the outputs of the UnionAll legs to the common type if necessary
2305+
// Next implicitly cast the outputs of the UnionAll branches to the common type if necessary
23062306
LogicalPlan planWithImplicitCasting = planWithConvertFunctionsReplaced.transformUp(
23072307
UnionAll.class,
23082308
unionAll -> unionAll.resolved() ? implicitCastingUnionAllOutput(unionAll, plan) : unionAll
@@ -2322,7 +2322,7 @@ private LogicalPlan maybePushDownConvertFunctions(UnionAll unionAll, LogicalPlan
23222322
return unionAll;
23232323
}
23242324

2325-
// push down the conversion functions into the unionAll legs
2325+
// push down the conversion functions into the unionAll branches
23262326
List<LogicalPlan> newChildren = new ArrayList<>(unionAll.children().size());
23272327
boolean outputChanged = false;
23282328
for (LogicalPlan child : unionAll.children()) {
@@ -2420,7 +2420,7 @@ private LogicalPlan implicitCastingUnionAllOutput(UnionAll unionAll, LogicalPlan
24202420

24212421
Map<Integer, DataType> indexToCommonType = new HashMap<>();
24222422

2423-
// Cast each leg's output to the common type
2423+
// Cast each branch's output to the common type
24242424
List<LogicalPlan> newChildren = new ArrayList<>(unionAll.children().size());
24252425
boolean outputChanged = false;
24262426
for (LogicalPlan child : unionAll.children()) {

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/logical/PushDownFilterAndLimitIntoUnionAll.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public LogicalPlan apply(LogicalPlan logicalPlan) {
5454
);
5555
}
5656

57-
/* Push down filters that can be evaluated by the UnionAll child/leg to each child/leg,
57+
/* Push down filters that can be evaluated by the UnionAll branch to each branch,
5858
* so that the filters can be pushed down further to the data source when possible.
5959
* Filters that cannot be pushed down remain above the UnionAll.
6060
*

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,23 @@
2222

2323
public class UnionAll extends Fork implements PostOptimizationPlanVerificationAware {
2424

25-
private final List<Attribute> output;
26-
2725
public UnionAll(Source source, List<LogicalPlan> children, List<Attribute> output) {
2826
super(source, children, output);
29-
this.output = output;
3027
}
3128

3229
@Override
3330
public LogicalPlan replaceChildren(List<LogicalPlan> newChildren) {
34-
return new UnionAll(source(), newChildren, output);
31+
return new UnionAll(source(), newChildren, output());
3532
}
3633

3734
@Override
3835
protected NodeInfo<? extends LogicalPlan> info() {
39-
return NodeInfo.create(this, UnionAll::new, children(), output);
36+
return NodeInfo.create(this, UnionAll::new, children(), output());
4037
}
4138

4239
@Override
4340
public UnionAll replaceSubPlans(List<LogicalPlan> subPlans) {
44-
return new UnionAll(source(), subPlans, output);
41+
return new UnionAll(source(), subPlans, output());
4542
}
4643

4744
@Override

0 commit comments

Comments
 (0)