Skip to content

Commit ea00c61

Browse files
craigtavernerdavidkyle
authored andcommitted
Remove PushTopNToSource support for ExchangeExec (elastic#114637)
This appears to be dead code, so we're removing it.
1 parent 6a79c76 commit ea00c61

File tree

1 file changed

+0
-19
lines changed
  • x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/physical/local

1 file changed

+0
-19
lines changed

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

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.elasticsearch.xpack.esql.optimizer.PhysicalOptimizerRules;
2525
import org.elasticsearch.xpack.esql.plan.physical.EsQueryExec;
2626
import org.elasticsearch.xpack.esql.plan.physical.EvalExec;
27-
import org.elasticsearch.xpack.esql.plan.physical.ExchangeExec;
2827
import org.elasticsearch.xpack.esql.plan.physical.PhysicalPlan;
2928
import org.elasticsearch.xpack.esql.plan.physical.TopNExec;
3029

@@ -82,17 +81,6 @@ public PhysicalPlan rewrite(TopNExec topNExec) {
8281
}
8382
}
8483

85-
/**
86-
* TODO: Consider deleting this case entirely. We do not know if this is ever hit.
87-
*/
88-
record PushableExchangeExec(ExchangeExec exchangeExec, EsQueryExec queryExec) implements Pushable {
89-
public PhysicalPlan rewrite(TopNExec topNExec) {
90-
var sorts = buildFieldSorts(topNExec.order());
91-
var limit = topNExec.limit();
92-
return exchangeExec.replaceChild(queryExec.withSorts(sorts).withLimit(limit));
93-
}
94-
}
95-
9684
record PushableQueryExec(EsQueryExec queryExec) implements Pushable {
9785
public PhysicalPlan rewrite(TopNExec topNExec) {
9886
var sorts = buildFieldSorts(topNExec.order());
@@ -141,13 +129,6 @@ && canPushDownOrders(topNExec.order(), hasIdenticalDelegate)) {
141129
// With the simplest case of `FROM index | SORT ...` we only allow pushing down if the sort is on a field
142130
return new PushableQueryExec(queryExec);
143131
}
144-
if (child instanceof ExchangeExec exchangeExec
145-
&& exchangeExec.child() instanceof EsQueryExec queryExec
146-
&& queryExec.canPushSorts()
147-
&& canPushDownOrders(topNExec.order(), hasIdenticalDelegate)) {
148-
// When we have an exchange between the FROM and the SORT, we also only allow pushing down if the sort is on a field
149-
return new PushableExchangeExec(exchangeExec, queryExec);
150-
}
151132
if (child instanceof EvalExec evalExec && evalExec.child() instanceof EsQueryExec queryExec && queryExec.canPushSorts()) {
152133
// When we have an EVAL between the FROM and the SORT, we consider pushing down if the sort is on a field and/or
153134
// a distance function defined in the EVAL. We also move the EVAL to after the SORT.

0 commit comments

Comments
 (0)