Class RelOptSamplingParameters

java.lang.Object
org.apache.calcite.plan.RelOptSamplingParameters

public class RelOptSamplingParameters extends Object
RelOptSamplingParameters represents the parameters necessary to produce a sample of a relation.

It's parameters are derived from the SQL 2003 TABLESAMPLE clause.

  • Constructor Details

    • RelOptSamplingParameters

      public RelOptSamplingParameters(boolean isBernoulli, float samplingPercentage, boolean isRepeatable, int repeatableSeed)
  • Method Details

    • isBernoulli

      public boolean isBernoulli()
      Indicates whether Bernoulli or system sampling should be performed. Bernoulli sampling requires the decision whether to include each row in the sample to be independent across rows. System sampling allows implementation-dependent behavior.
      Returns:
      true if Bernoulli sampling is configured, false for system sampling
    • getSamplingPercentage

      public float getSamplingPercentage()
      Returns the sampling percentage. For Bernoulli sampling, the sampling percentage is the likelihood that any given row will be included in the sample. For system sampling, the sampling percentage indicates (roughly) what percentage of the rows will appear in the sample.
      Returns:
      the sampling percentage between 0.0 and 1.0, exclusive
    • isRepeatable

      public boolean isRepeatable()
      Indicates whether the sample results should be repeatable. Sample results are only required to repeat if no changes have been made to the relation's content or structure. If the sample is configured to be repeatable, then a user-specified seed value can be obtained via getRepeatableSeed().
      Returns:
      true if the sample results should be repeatable
    • getRepeatableSeed

      public int getRepeatableSeed()
      If isRepeatable() returns true, this method returns a user-specified seed value. Samples of the same, unmodified relation should be identical if the sampling mode, sampling percentage and repeatable seed are the same.
      Returns:
      seed value for repeatable samples