Skip to content

Commit f881d2d

Browse files
Delete OrderExec
1 parent a5d30ef commit f881d2d

File tree

6 files changed

+3
-150
lines changed

6 files changed

+3
-150
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
* <p>
3939
* from test | sort x | mv_expand x | sort y
4040
* <p>
41-
* "sort y" will become a TopN, but "sort x" will remain unbounded, so the query could not be executed.
41+
* "sort y" will become a TopN due to the addition of the default Limit, but "sort x" will remain unbounded,
42+
* so the query could not be executed.
4243
* <p>
4344
* In most cases though, following commands can make the previous SORTs redundant,
4445
* because it will re-sort previously sorted results (eg. if there is another SORT)

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
import org.elasticsearch.xpack.esql.plan.physical.LimitExec;
4444
import org.elasticsearch.xpack.esql.plan.physical.LocalSourceExec;
4545
import org.elasticsearch.xpack.esql.plan.physical.MvExpandExec;
46-
import org.elasticsearch.xpack.esql.plan.physical.OrderExec;
4746
import org.elasticsearch.xpack.esql.plan.physical.ProjectExec;
4847
import org.elasticsearch.xpack.esql.plan.physical.ShowExec;
4948
import org.elasticsearch.xpack.esql.plan.physical.SubqueryExec;
@@ -103,7 +102,6 @@ public static List<NamedWriteableRegistry.Entry> phsyical() {
103102
LimitExec.ENTRY,
104103
LocalSourceExec.ENTRY,
105104
MvExpandExec.ENTRY,
106-
OrderExec.ENTRY,
107105
ProjectExec.ENTRY,
108106
ShowExec.ENTRY,
109107
SubqueryExec.ENTRY,

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

Lines changed: 0 additions & 88 deletions
This file was deleted.

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import org.elasticsearch.xpack.esql.plan.logical.LeafPlan;
1818
import org.elasticsearch.xpack.esql.plan.logical.Limit;
1919
import org.elasticsearch.xpack.esql.plan.logical.LogicalPlan;
20-
import org.elasticsearch.xpack.esql.plan.logical.OrderBy;
2120
import org.elasticsearch.xpack.esql.plan.logical.TopN;
2221
import org.elasticsearch.xpack.esql.plan.logical.UnaryPlan;
2322
import org.elasticsearch.xpack.esql.plan.logical.join.Join;
@@ -28,7 +27,6 @@
2827
import org.elasticsearch.xpack.esql.plan.physical.LimitExec;
2928
import org.elasticsearch.xpack.esql.plan.physical.LocalSourceExec;
3029
import org.elasticsearch.xpack.esql.plan.physical.LookupJoinExec;
31-
import org.elasticsearch.xpack.esql.plan.physical.OrderExec;
3230
import org.elasticsearch.xpack.esql.plan.physical.PhysicalPlan;
3331
import org.elasticsearch.xpack.esql.plan.physical.TopNExec;
3432

@@ -81,10 +79,6 @@ private PhysicalPlan mapUnary(UnaryPlan unary) {
8179
return new LimitExec(limit.source(), mappedChild, limit.limit());
8280
}
8381

84-
if (unary instanceof OrderBy o) {
85-
return new OrderExec(o.source(), mappedChild, o.order());
86-
}
87-
8882
if (unary instanceof TopN topN) {
8983
return new TopNExec(topN.source(), mappedChild, topN.order(), topN.limit(), null);
9084
}

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.elasticsearch.xpack.esql.plan.physical.LimitExec;
3333
import org.elasticsearch.xpack.esql.plan.physical.LocalSourceExec;
3434
import org.elasticsearch.xpack.esql.plan.physical.LookupJoinExec;
35-
import org.elasticsearch.xpack.esql.plan.physical.OrderExec;
3635
import org.elasticsearch.xpack.esql.plan.physical.PhysicalPlan;
3736
import org.elasticsearch.xpack.esql.plan.physical.TopNExec;
3837
import org.elasticsearch.xpack.esql.plan.physical.UnaryExec;
@@ -105,7 +104,7 @@ private PhysicalPlan mapUnary(UnaryPlan unary) {
105104
return enrichExec.child();
106105
}
107106
if (f instanceof UnaryExec unaryExec) {
108-
if (f instanceof LimitExec || f instanceof ExchangeExec || f instanceof OrderExec || f instanceof TopNExec) {
107+
if (f instanceof LimitExec || f instanceof ExchangeExec || f instanceof TopNExec) {
109108
return f;
110109
} else {
111110
return unaryExec.child();
@@ -161,11 +160,6 @@ private PhysicalPlan mapUnary(UnaryPlan unary) {
161160
return new LimitExec(limit.source(), mappedChild, limit.limit());
162161
}
163162

164-
if (unary instanceof OrderBy o) {
165-
mappedChild = addExchangeForFragment(o, mappedChild);
166-
return new OrderExec(o.source(), mappedChild, o.order());
167-
}
168-
169163
if (unary instanceof TopN topN) {
170164
mappedChild = addExchangeForFragment(topN, mappedChild);
171165
return new TopNExec(topN.source(), mappedChild, topN.order(), topN.limit(), null);

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/plan/physical/OrderExecSerializationTests.java

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)