Package org.elasticsearch.xpack.esql.optimizer.rules.physical.local
package org.elasticsearch.xpack.esql.optimizer.rules.physical.local
-
ClassDescriptionWhen a spatial distance predicate can be pushed down to lucene, this is done by capturing the distance within the same function.A rule that moves `VALUES(dimension-field)` aggregations in time-series aggregations to execute after the aggregation, reading the dimension fields once each group.Materialize the concrete fields that need to be extracted from the storage until the last possible moment.When deciding if a filter or topN can be pushed down to Lucene, we need to check a few things on the field.Replaces
AggregateExec → ExternalSourceExecwithLocalSourceExecwhen ungrouped aggregates (COUNT(*), MIN, MAX) can be computed from file-level statistics.Pushes count aggregations on top of query and tags to source.ReplacesExpressions that can be pushed to field loading with a field attribute that calculates the expression during value loading.Pushes a LIMIT intoExternalSourceExecso the source can stop reading early.Pushes ungrouped aggregate functions (COUNT, MIN, MAX) to external sources when the required statistics are available in the file metadata.Looks for the case where certain stats exist right before the query and thus can be pushed down.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.ReplaceRoundToWithQueryAndTagsbuilds a list of ranges and associated tags base on the rounding points defined in aRoundTofunction.If the original aggregate wrapped by the sampled aggregate can be pushed down to Lucene (so that it will execute exact and fast), sampling should be skipped and the original aggregate should be executed.If the original aggregate wrapped by the sampled aggregate cannot be pushed down to Lucene (which would execute exact and fast), sampling should be used to speed up the aggregation.Strips source leaf nodes down to their minimal output attributes so thatInsertFieldExtractioncan later add only the fields that the rest of the plan actually needs.This rule is responsible for marking spatial fields to be extracted from doc-values instead of source values.This rule is responsible for marking spatial shape fields whose centroid or extent can be extracted from doc-values.