Class 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) | ...