Class ExtractDimensionFieldsAfterAggregation
java.lang.Object
org.elasticsearch.xpack.esql.rule.Rule<PhysicalPlan,PhysicalPlan>
org.elasticsearch.xpack.esql.rule.ParameterizedRule<PhysicalPlan,PhysicalPlan,LocalPhysicalOptimizerContext>
org.elasticsearch.xpack.esql.optimizer.PhysicalOptimizerRules.ParameterizedOptimizerRule<PhysicalPlan,LocalPhysicalOptimizerContext>
org.elasticsearch.xpack.esql.optimizer.rules.physical.local.ExtractDimensionFieldsAfterAggregation
public final class ExtractDimensionFieldsAfterAggregation
extends PhysicalOptimizerRules.ParameterizedOptimizerRule<PhysicalPlan,LocalPhysicalOptimizerContext>
A rule that moves `VALUES(dimension-field)` aggregations in time-series aggregations
to execute after the aggregation, reading the dimension fields once each group.
This is possible because dimension field values for `_tsid` are identical across all
documents in the same time-series.
For example:
`TS .. | STATS sum(rate(r1)), sum(rate(r2)) BY cluster, host, tbucket(1m)`
without this rule
`TS ..
| EXTRACT_FIELDS(r1,r2,cluster, host)
| STATS rate(r1), rate(r2), VALUES(cluster), VALUES(host) BY _tsid, tbucket(1m)`
with this rule
`TS ..
| EXTRACT_FIELDS(r1,r2)
| STATS rate(r1), rate(r2), FIRST_DOC_ID(_doc) BY _tsid, tbucket(1m)
| EXTRACT_FIELDS(cluster, host)
| ...
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.elasticsearch.xpack.esql.optimizer.PhysicalOptimizerRules.ParameterizedOptimizerRule
applyMethods inherited from class org.elasticsearch.xpack.esql.rule.ParameterizedRule
apply
-
Constructor Details
-
ExtractDimensionFieldsAfterAggregation
public ExtractDimensionFieldsAfterAggregation()
-
-
Method Details
-
rule
- Specified by:
rulein classPhysicalOptimizerRules.ParameterizedOptimizerRule<PhysicalPlan,LocalPhysicalOptimizerContext>
-