Skip to content

Commit 74e780c

Browse files
committed
Format
1 parent d0677c0 commit 74e780c

File tree

14 files changed

+65
-50
lines changed

14 files changed

+65
-50
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/LogicalPlanOptimizer.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.elasticsearch.xpack.esql.optimizer.rules.logical.PropagateEvalFoldables;
2929
import org.elasticsearch.xpack.esql.optimizer.rules.logical.PropagateInlineEvals;
3030
import org.elasticsearch.xpack.esql.optimizer.rules.logical.PropagateNullable;
31-
import org.elasticsearch.xpack.esql.optimizer.rules.logical.ReplaceTopNAndAggregateWithTopNAggregate;
3231
import org.elasticsearch.xpack.esql.optimizer.rules.logical.PropgateUnmappedFields;
3332
import org.elasticsearch.xpack.esql.optimizer.rules.logical.PruneColumns;
3433
import org.elasticsearch.xpack.esql.optimizer.rules.logical.PruneEmptyPlans;
@@ -55,6 +54,7 @@
5554
import org.elasticsearch.xpack.esql.optimizer.rules.logical.ReplaceRowAsLocalRelation;
5655
import org.elasticsearch.xpack.esql.optimizer.rules.logical.ReplaceStatsFilteredAggWithEval;
5756
import org.elasticsearch.xpack.esql.optimizer.rules.logical.ReplaceStringCasingWithInsensitiveEquals;
57+
import org.elasticsearch.xpack.esql.optimizer.rules.logical.ReplaceTopNAndAggregateWithTopNAggregate;
5858
import org.elasticsearch.xpack.esql.optimizer.rules.logical.ReplaceTrivialTypeConversions;
5959
import org.elasticsearch.xpack.esql.optimizer.rules.logical.SetAsOptimized;
6060
import org.elasticsearch.xpack.esql.optimizer.rules.logical.SimplifyComparisonsArithmetics;
@@ -209,6 +209,12 @@ protected static Batch<LogicalPlan> operators() {
209209
}
210210

211211
protected static Batch<LogicalPlan> cleanup() {
212-
return new Batch<>("Clean Up", new ReplaceLimitAndSortAsTopN(), new ReplaceTopNAndAggregateWithTopNAggregate(), new ReplaceRowAsLocalRelation(), new PropgateUnmappedFields());
212+
return new Batch<>(
213+
"Clean Up",
214+
new ReplaceLimitAndSortAsTopN(),
215+
new ReplaceTopNAndAggregateWithTopNAggregate(),
216+
new ReplaceRowAsLocalRelation(),
217+
new PropgateUnmappedFields()
218+
);
213219
}
214220
}

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ public class ReplaceTopNAndAggregateWithTopNAggregate extends Rule<TopN, Logical
2525

2626
@Override
2727
public LogicalPlan apply(LogicalPlan plan) {
28-
return plan.transformUp(
29-
TopN.class,
30-
this::applyRule
31-
);
28+
return plan.transformUp(TopN.class, this::applyRule);
3229
}
3330

3431
private LogicalPlan applyRule(TopN topN) {

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/physical/ProjectAwayColumns.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import org.elasticsearch.xpack.esql.plan.logical.Aggregate;
1818
import org.elasticsearch.xpack.esql.plan.logical.Eval;
1919
import org.elasticsearch.xpack.esql.plan.logical.Project;
20-
import org.elasticsearch.xpack.esql.plan.logical.TopN;
2120
import org.elasticsearch.xpack.esql.plan.logical.TopNAggregate;
2221
import org.elasticsearch.xpack.esql.plan.physical.ExchangeExec;
2322
import org.elasticsearch.xpack.esql.plan.physical.FragmentExec;

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/physical/local/InsertFieldExtraction.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import org.elasticsearch.xpack.esql.optimizer.PhysicalOptimizerRules;
1616
import org.elasticsearch.xpack.esql.optimizer.rules.physical.ProjectAwayColumns;
1717
import org.elasticsearch.xpack.esql.plan.physical.AbstractAggregateExec;
18-
import org.elasticsearch.xpack.esql.plan.physical.AggregateExec;
1918
import org.elasticsearch.xpack.esql.plan.physical.EsQueryExec;
2019
import org.elasticsearch.xpack.esql.plan.physical.FieldExtractExec;
2120
import org.elasticsearch.xpack.esql.plan.physical.LeafExec;

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/physical/local/PushStatsToSource.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@
4141
/**
4242
* Looks for the case where certain stats exist right before the query and thus can be pushed down.
4343
*/
44-
public class PushStatsToSource extends PhysicalOptimizerRules.ParameterizedOptimizerRule<AbstractAggregateExec, LocalPhysicalOptimizerContext> {
44+
public class PushStatsToSource extends PhysicalOptimizerRules.ParameterizedOptimizerRule<
45+
AbstractAggregateExec,
46+
LocalPhysicalOptimizerContext> {
4547

4648
@Override
4749
protected PhysicalPlan rule(AbstractAggregateExec aggregateExec, LocalPhysicalOptimizerContext context) {

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@
1010
import org.elasticsearch.common.io.stream.StreamInput;
1111
import org.elasticsearch.common.io.stream.StreamOutput;
1212
import org.elasticsearch.xpack.esql.core.capabilities.Resolvables;
13-
import org.elasticsearch.xpack.esql.core.expression.Alias;
1413
import org.elasticsearch.xpack.esql.core.expression.Attribute;
1514
import org.elasticsearch.xpack.esql.core.expression.AttributeSet;
1615
import org.elasticsearch.xpack.esql.core.expression.Expression;
17-
import org.elasticsearch.xpack.esql.core.expression.Expressions;
1816
import org.elasticsearch.xpack.esql.core.expression.NamedExpression;
1917
import org.elasticsearch.xpack.esql.core.tree.NodeInfo;
2018
import org.elasticsearch.xpack.esql.core.tree.Source;
@@ -25,9 +23,6 @@
2523
import java.util.List;
2624
import java.util.Objects;
2725

28-
import static java.util.Collections.emptyList;
29-
import static org.elasticsearch.xpack.esql.expression.NamedExpressions.mergeOutputAttributes;
30-
3126
// TODO: Should this be TelemetryAware?
3227
public class TopNAggregate extends UnaryPlan {
3328
public static final NamedWriteableRegistry.Entry ENTRY = new NamedWriteableRegistry.Entry(
@@ -47,7 +42,8 @@ public class TopNAggregate extends UnaryPlan {
4742
public TopNAggregate(
4843
Source source,
4944
LogicalPlan child,
50-
List<Expression> groupings, List<? extends NamedExpression> aggregates,
45+
List<Expression> groupings,
46+
List<? extends NamedExpression> aggregates,
5147
List<Order> order,
5248
Expression limit
5349
) {

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan/physical/AggregateExec.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
package org.elasticsearch.xpack.esql.plan.physical;
99

10-
import org.elasticsearch.TransportVersions;
1110
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
1211
import org.elasticsearch.common.io.stream.StreamInput;
1312
import org.elasticsearch.common.io.stream.StreamOutput;

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan/physical/TopNAggregateExec.java

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import org.elasticsearch.common.io.stream.StreamInput;
1212
import org.elasticsearch.common.io.stream.StreamOutput;
1313
import org.elasticsearch.compute.aggregation.AggregatorMode;
14-
import org.elasticsearch.core.Nullable;
1514
import org.elasticsearch.xpack.esql.core.expression.Attribute;
1615
import org.elasticsearch.xpack.esql.core.expression.Expression;
1716
import org.elasticsearch.xpack.esql.core.expression.NamedExpression;
@@ -72,7 +71,16 @@ public String getWriteableName() {
7271
@Override
7372
protected NodeInfo<TopNAggregateExec> info() {
7473
return NodeInfo.create(
75-
this, TopNAggregateExec::new, child(), groupings, aggregates, mode, intermediateAttributes, estimatedRowSize, order, limit
74+
this,
75+
TopNAggregateExec::new,
76+
child(),
77+
groupings,
78+
aggregates,
79+
mode,
80+
intermediateAttributes,
81+
estimatedRowSize,
82+
order,
83+
limit
7684
);
7785
}
7886

@@ -84,7 +92,10 @@ public TopNAggregateExec replaceChild(PhysicalPlan newChild) {
8492
groupings,
8593
aggregates,
8694
mode,
87-
intermediateAttributes, estimatedRowSize, order, limit
95+
intermediateAttributes,
96+
estimatedRowSize,
97+
order,
98+
limit
8899
);
89100
}
90101

@@ -99,13 +110,31 @@ public Expression limit() {
99110
@Override
100111
protected TopNAggregateExec withEstimatedSize(int estimatedRowSize) {
101112
return new TopNAggregateExec(
102-
source(), child(), groupings, aggregates, mode, intermediateAttributes, estimatedRowSize, order, limit
113+
source(),
114+
child(),
115+
groupings,
116+
aggregates,
117+
mode,
118+
intermediateAttributes,
119+
estimatedRowSize,
120+
order,
121+
limit
103122
);
104123
}
105124

106125
@Override
107126
public TopNAggregateExec withMode(AggregatorMode newMode) {
108-
return new TopNAggregateExec(source(), child(), groupings, aggregates, newMode, intermediateAttributes, estimatedRowSize, order, limit);
127+
return new TopNAggregateExec(
128+
source(),
129+
child(),
130+
groupings,
131+
aggregates,
132+
newMode,
133+
intermediateAttributes,
134+
estimatedRowSize,
135+
order,
136+
limit
137+
);
109138
}
110139

111140
@Override

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner/AbstractPhysicalOperationProviders.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import org.elasticsearch.xpack.esql.expression.function.aggregate.Count;
3838
import org.elasticsearch.xpack.esql.expression.function.grouping.Categorize;
3939
import org.elasticsearch.xpack.esql.plan.physical.AbstractAggregateExec;
40-
import org.elasticsearch.xpack.esql.plan.physical.AggregateExec;
4140
import org.elasticsearch.xpack.esql.plan.physical.TimeSeriesAggregateExec;
4241
import org.elasticsearch.xpack.esql.plan.physical.TopNAggregateExec;
4342
import org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.LocalExecutionPlannerContext;

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner/EsPhysicalOperationProviders.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
import org.elasticsearch.xpack.esql.core.type.PotentiallyUnmappedKeywordEsField;
6363
import org.elasticsearch.xpack.esql.expression.function.scalar.convert.AbstractConvertFunction;
6464
import org.elasticsearch.xpack.esql.plan.physical.AbstractAggregateExec;
65-
import org.elasticsearch.xpack.esql.plan.physical.AggregateExec;
6665
import org.elasticsearch.xpack.esql.plan.physical.EsQueryExec;
6766
import org.elasticsearch.xpack.esql.plan.physical.EsQueryExec.Sort;
6867
import org.elasticsearch.xpack.esql.plan.physical.FieldExtractExec;

0 commit comments

Comments
 (0)