org.eigenbase.relopt
Class RelOptSamplingParameters

java.lang.Object
  extended by org.eigenbase.relopt.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.

Author:
Stephan Zuercher

Field Summary
private  boolean isBernoulli
           
private  boolean isRepeatable
           
private  int repeatableSeed
           
private  float samplingPercentage
           
 
Constructor Summary
RelOptSamplingParameters(boolean isBernoulli, float samplingPercentage, boolean isRepeatable, int repeatableSeed)
           
 
Method Summary
 int getRepeatableSeed()
          If isRepeatable() returns true, this method returns a user-specified seed value.
 float getSamplingPercentage()
          Returns the sampling percentage.
 boolean isBernoulli()
          Indicates whether Bernoulli or system sampling should be performed.
 boolean isRepeatable()
          Indicates whether the sample results should be repeatable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isBernoulli

private final boolean isBernoulli

samplingPercentage

private final float samplingPercentage

isRepeatable

private final boolean isRepeatable

repeatableSeed

private final int repeatableSeed
Constructor Detail

RelOptSamplingParameters

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

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 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