Package org.apache.calcite.sql
Class SqlSampleSpec
- java.lang.Object
-
- org.apache.calcite.sql.SqlSampleSpec
-
- Direct Known Subclasses:
SqlSampleSpec.SqlSubstitutionSampleSpec
,SqlSampleSpec.SqlTableSampleSpec
public abstract class SqlSampleSpec extends java.lang.Object
Specification of a SQL sample.For example, the query
SELECT * FROM emp TABLESAMPLE SUBSTITUTE('medium')
declares a sample which is created using
createNamed(java.lang.String)
.A sample is not a
SqlNode
. To include it in a parse tree, wrap it as a literal, viz:SqlLiteral.createSample(SqlSampleSpec, org.apache.calcite.sql.parser.SqlParserPos)
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SqlSampleSpec.SqlSubstitutionSampleSpec
Sample specification that orders substitution.static class
SqlSampleSpec.SqlTableSampleSpec
Sample specification.
-
Constructor Summary
Constructors Modifier Constructor Description protected
SqlSampleSpec()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SqlSampleSpec
createNamed(java.lang.String name)
Creates a sample which substitutes one relation for another.static SqlSampleSpec
createTableSample(boolean isBernoulli, float samplePercentage)
Creates a table sample without repeatability.static SqlSampleSpec
createTableSample(boolean isBernoulli, float samplePercentage, int repeatableSeed)
Creates a table sample with repeatability.
-
-
-
Method Detail
-
createNamed
public static SqlSampleSpec createNamed(java.lang.String name)
Creates a sample which substitutes one relation for another.
-
createTableSample
public static SqlSampleSpec createTableSample(boolean isBernoulli, float samplePercentage)
Creates a table sample without repeatability.- Parameters:
isBernoulli
- true if Bernoulli style sampling is to be used; false for implementation specific samplingsamplePercentage
- likelihood of a row appearing in the sample
-
createTableSample
public static SqlSampleSpec createTableSample(boolean isBernoulli, float samplePercentage, int repeatableSeed)
Creates a table sample with repeatability.- Parameters:
isBernoulli
- true if Bernoulli style sampling is to be used; false for implementation specific samplingsamplePercentage
- likelihood of a row appearing in the samplerepeatableSeed
- seed value used to reproduce the same sample
-
-