Class PushTopNToSource
java.lang.Object
org.elasticsearch.xpack.esql.rule.Rule<TopNExec,PhysicalPlan>
org.elasticsearch.xpack.esql.rule.ParameterizedRule<TopNExec,PhysicalPlan,LocalPhysicalOptimizerContext>
org.elasticsearch.xpack.esql.optimizer.PhysicalOptimizerRules.ParameterizedOptimizerRule<TopNExec,LocalPhysicalOptimizerContext>
org.elasticsearch.xpack.esql.optimizer.rules.physical.local.PushTopNToSource
public class PushTopNToSource
extends PhysicalOptimizerRules.ParameterizedOptimizerRule<TopNExec,LocalPhysicalOptimizerContext>
We handle two main scenarios here:
- Queries like `FROM index | SORT field` will be pushed to the source if the field is an indexed field.
-
Queries like `FROM index | EVAL ref = ... | SORT ref` will be pushed to the source if the reference function is pushable,
which can happen under two conditions:
- The reference refers linearly to an indexed field. For example: `FROM index | EVAL ref = field | SORT ref`
- The reference refers to a distance function that refers to an indexed field and a constant expression. For example `FROM index | EVAL distance = ST_DISTANCE(field, POINT(0, 0)) | SORT distance`. As with the previous condition, both the attribute and the constant can be further aliased.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected PhysicalPlanrule(TopNExec topNExec, LocalPhysicalOptimizerContext ctx) Methods inherited from class org.elasticsearch.xpack.esql.optimizer.PhysicalOptimizerRules.ParameterizedOptimizerRule
applyMethods inherited from class org.elasticsearch.xpack.esql.rule.ParameterizedRule
apply
-
Constructor Details
-
PushTopNToSource
public PushTopNToSource()
-
-
Method Details
-
rule
- Specified by:
rulein classPhysicalOptimizerRules.ParameterizedOptimizerRule<TopNExec,LocalPhysicalOptimizerContext>
-