Class ReplaceSampledStatsBySampleAndStats
java.lang.Object
org.elasticsearch.xpack.esql.rule.Rule<SampledAggregateExec,PhysicalPlan>
org.elasticsearch.xpack.esql.optimizer.PhysicalOptimizerRules.OptimizerRule<SampledAggregateExec>
org.elasticsearch.xpack.esql.optimizer.rules.physical.local.ReplaceSampledStatsBySampleAndStats
public class ReplaceSampledStatsBySampleAndStats
extends PhysicalOptimizerRules.OptimizerRule<SampledAggregateExec>
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.
In that case, this rule replaces the sampled aggregate by a regular aggregate on top of a sample, with intermediate state corrections for sample-corrected aggregates (COUNT, SUM). The plan:
FROM data | commands | SAMPLED_STATS[prob] aggs
is transformed into:
FROM data | SAMPLE prob | commands | STATS aggs | EVAL sample_correction
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.elasticsearch.xpack.esql.optimizer.PhysicalOptimizerRules.OptimizerRule
apply
-
Constructor Details
-
ReplaceSampledStatsBySampleAndStats
public ReplaceSampledStatsBySampleAndStats()
-
-
Method Details
-
rule
- Specified by:
rulein classPhysicalOptimizerRules.OptimizerRule<SampledAggregateExec>
-