Class PushDownAndCombineSample


public class PushDownAndCombineSample extends OptimizerRules.ParameterizedOptimizerRule<Sample,LogicalOptimizerContext>
Pushes down the SAMPLE operator. SAMPLE can be pushed down through an operator if

| SAMPLE p | OPERATOR

is equivalent to

| OPERATOR | SAMPLE p

statistically (i.e. same possible output with same probabilities). In that case, we push down sampling to Lucene for efficiency.

As a rule of thumb, if an operator can be swapped with sampling if it maps:

  • one row to one row (e.g. DISSECT, DROP, ENRICH, EVAL, GROK, KEEP, RENAME)
  • one row to zero or one row (WHERE)
  • reorders the rows (SORT)