Class SpatialShapeDocValuesExtraction
java.lang.Object
org.elasticsearch.xpack.esql.rule.Rule<AggregateExec,PhysicalPlan>
org.elasticsearch.xpack.esql.rule.ParameterizedRule<AggregateExec,PhysicalPlan,LocalPhysicalOptimizerContext>
org.elasticsearch.xpack.esql.optimizer.PhysicalOptimizerRules.ParameterizedOptimizerRule<AggregateExec,LocalPhysicalOptimizerContext>
org.elasticsearch.xpack.esql.optimizer.rules.physical.local.SpatialShapeDocValuesExtraction
public class SpatialShapeDocValuesExtraction
extends PhysicalOptimizerRules.ParameterizedOptimizerRule<AggregateExec,LocalPhysicalOptimizerContext>
This rule is responsible for marking spatial shape fields whose centroid or extent can be extracted from doc-values.
This optimization applies to
ST_CENTROID_AGG and ST_EXTENT_AGG aggregations on shape types.
Normally spatial fields are extracted from source values because this maintains original precision, but is very slow. The centroid data (location and weight) and extent bounds are stored in the header of the shape doc-values, allowing for fast extraction without reading the full geometry.
We only apply this optimization under specific conditions:
- The spatial data is of type GEO_SHAPE or CARTESIAN_SHAPE.
- The spatial data is consumed directly by
ST_CENTROID_AGGorST_EXTENT_AGG. - The spatial data is not consumed by any other operation (except the other spatial aggregation).
- The field has doc-values enabled.
When both ST_CENTROID_AGG and ST_EXTENT_AGG operate on the same field, this rule ensures
both aggregations use the combined extraction preference (EXTRACT_SPATIAL_BOUNDS_AND_CENTROID).
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected PhysicalPlanrule(AggregateExec aggregate, 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
-
SpatialShapeDocValuesExtraction
public SpatialShapeDocValuesExtraction()
-
-
Method Details
-
rule
- Specified by:
rulein classPhysicalOptimizerRules.ParameterizedOptimizerRule<AggregateExec,LocalPhysicalOptimizerContext>
-