Package org.apache.calcite.test.catalog
Class MockCatalogReader.MockTable
java.lang.Object
org.apache.calcite.prepare.Prepare.AbstractPreparingTable
org.apache.calcite.test.catalog.MockCatalogReader.MockTable
- All Implemented Interfaces:
RelOptTable,Prepare.PreparingTable,BuiltInMetadata.MaxRowCount.Handler,MetadataHandler<BuiltInMetadata.MaxRowCount>,Wrapper,SqlValidatorTable
- Direct Known Subclasses:
MockCatalogReader.MockModifiableViewRelOptTable,MockCatalogReader.MockRelViewTable,MockCatalogReader.MockViewTable,MockCatalogReader.MustFilterMockTable
- Enclosing class:
MockCatalogReader
public static class MockCatalogReader.MockTable
extends Prepare.AbstractPreparingTable
implements BuiltInMetadata.MaxRowCount.Handler
Mock implementation of
Prepare.PreparingTable.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.calcite.plan.RelOptTable
RelOptTable.ToRelContext, RelOptTable.ViewExpander -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final MockCatalogReaderprotected List<RelCollation>protected final List<Map.Entry<String,RelDataType>> protected final InitializerExpressionFactoryprotected final List<ImmutableBitSet>protected StructKindprotected final Doubleprotected final List<RelReferentialConstraint>protected final @Nullable MockCatalogReader.ColumnResolverprotected final doubleprotected RelDataTypeprotected final booleanWrapped objects that can be obtained by callingunwrap(Class). -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMockTable(MockCatalogReader catalogReader, boolean stream, boolean temporal, double rowCount, List<Map.Entry<String, RelDataType>> columnList, List<ImmutableBitSet> keyList, RelDataType rowType, List<RelCollation> collationList, List<String> names, Set<String> monotonicColumnSet, StructKind kind, @Nullable MockCatalogReader.ColumnResolver resolver, InitializerExpressionFactory initializerFactory) Copy constructor.MockTable(MockCatalogReader catalogReader, String catalogName, String schemaName, String name, boolean stream, boolean temporal, double rowCount, @Nullable MockCatalogReader.ColumnResolver resolver, InitializerExpressionFactory initializerFactory) MockTable(MockCatalogReader catalogReader, String catalogName, String schemaName, String name, boolean stream, boolean temporal, double rowCount, @Nullable MockCatalogReader.ColumnResolver resolver, InitializerExpressionFactory initializerFactory, Double maxRowCount) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddColumn(String name, RelDataType type) voidaddColumn(String name, RelDataType type, boolean isKey) voidvoidaddKey(ImmutableBitSet key) voidaddMonotonic(String name) voidstatic MockCatalogReader.MockTablecreate(MockCatalogReader catalogReader, List<String> names, boolean stream, double rowCount) static MockCatalogReader.MockTablecreate(MockCatalogReader catalogReader, MockCatalogReader.MockSchema schema, String name, boolean stream, double rowCount) static MockCatalogReader.MockTablecreate(MockCatalogReader catalogReader, MockCatalogReader.MockSchema schema, String name, boolean stream, double rowCount, double maxRowCount) static MockCatalogReader.MockTablecreate(MockCatalogReader catalogReader, MockCatalogReader.MockSchema schema, String name, boolean stream, double rowCount, @Nullable MockCatalogReader.ColumnResolver resolver) static MockCatalogReader.MockTablecreate(MockCatalogReader catalogReader, MockCatalogReader.MockSchema schema, String name, boolean stream, double rowCount, @Nullable MockCatalogReader.ColumnResolver resolver, double maxRowCount) static MockCatalogReader.MockTablecreate(MockCatalogReader catalogReader, MockCatalogReader.MockSchema schema, String name, boolean stream, double rowCount, @Nullable MockCatalogReader.ColumnResolver resolver, InitializerExpressionFactory initializerExpressionFactory, boolean temporal) static MockCatalogReader.MockTablecreate(MockCatalogReader catalogReader, MockCatalogReader.MockSchema schema, String name, boolean stream, double rowCount, @Nullable MockCatalogReader.ColumnResolver resolver, InitializerExpressionFactory initializerExpressionFactory, boolean temporal, Double maxRowCount) protected RelOptTableImplementation-specific code to instantiate a newRelOptTablebased on aTablethat has been extended.Returns the access type of the table.Returns a description of the physical ordering (or orderings) of the rows returned from this table.getDef()Returns a description of the physical distribution of the rows in this table.getExpression(Class clazz) Generates code for this table.getKeys()Returns a list of unique keys, empty list if no key exist, the result should be consistent withisKey.getKind()@Nullable DoublegetMonotonicity(String columnName) Returns whether a given column is monotonic.Obtains an identifier for this table.Returns the referential constraints existing for this table.Returns theRelOptSchemathis table belongs to.doubleReturns an estimate of the number of rows in the table.Describes the type of rows returned by this table.booleanisKey(ImmutableBitSet columns) Returns whether the given columns are a key or a superset of a unique key of this table.booleanReturns whether the table is temporal.voidonRegister(RelDataTypeFactory typeFactory) voidregisterRolledUpColumn(String columnName) voidsetKind(StructKind kind) booleansupportsModality(SqlModality modality) toRel(RelOptTable.ToRelContext context) Converts this table into arelational expression.<T> TFinds an instance of an interface implemented by this object, or returns null if this object does not support that interface.Methods inherited from class org.apache.calcite.prepare.Prepare.AbstractPreparingTable
columnHasDefaultValue, extend, getColumnStrategiesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.calcite.sql.validate.SqlValidatorTable
tableMethods inherited from interface org.apache.calcite.schema.Wrapper
maybeUnwrap, unwrapOrThrow
-
Field Details
-
catalogReader
-
stream
protected final boolean stream -
rowCount
protected final double rowCount -
columnList
-
keyList
-
referentialConstraints
-
rowType
-
collationList
-
names
-
maxRowCount
-
monotonicColumnSet
-
kind
-
resolver
-
initializerFactory
-
rolledUpColumns
-
wraps
Wrapped objects that can be obtained by callingunwrap(Class). Initially an immutable list, but converted to a mutable array list on first assignment.
-
-
Constructor Details
-
MockTable
public MockTable(MockCatalogReader catalogReader, String catalogName, String schemaName, String name, boolean stream, boolean temporal, double rowCount, @Nullable MockCatalogReader.ColumnResolver resolver, InitializerExpressionFactory initializerFactory) -
MockTable
public MockTable(MockCatalogReader catalogReader, String catalogName, String schemaName, String name, boolean stream, boolean temporal, double rowCount, @Nullable MockCatalogReader.ColumnResolver resolver, InitializerExpressionFactory initializerFactory, Double maxRowCount) -
MockTable
protected MockTable(MockCatalogReader catalogReader, boolean stream, boolean temporal, double rowCount, List<Map.Entry<String, RelDataType>> columnList, List<ImmutableBitSet> keyList, RelDataType rowType, List<RelCollation> collationList, List<String> names, Set<String> monotonicColumnSet, StructKind kind, @Nullable MockCatalogReader.ColumnResolver resolver, InitializerExpressionFactory initializerFactory) Copy constructor.
-
-
Method Details
-
registerRolledUpColumn
-
addWrap
-
getMaxRowCount
- Specified by:
getMaxRowCountin interfaceBuiltInMetadata.MaxRowCount.Handler
-
getDef
- Specified by:
getDefin interfaceBuiltInMetadata.MaxRowCount.Handler- Specified by:
getDefin interfaceMetadataHandler<BuiltInMetadata.MaxRowCount>
-
extend
Description copied from class:Prepare.AbstractPreparingTableImplementation-specific code to instantiate a newRelOptTablebased on aTablethat has been extended.- Specified by:
extendin classPrepare.AbstractPreparingTable
-
create
public static MockCatalogReader.MockTable create(MockCatalogReader catalogReader, MockCatalogReader.MockSchema schema, String name, boolean stream, double rowCount) -
create
public static MockCatalogReader.MockTable create(MockCatalogReader catalogReader, MockCatalogReader.MockSchema schema, String name, boolean stream, double rowCount, double maxRowCount) -
create
public static MockCatalogReader.MockTable create(MockCatalogReader catalogReader, List<String> names, boolean stream, double rowCount) -
create
public static MockCatalogReader.MockTable create(MockCatalogReader catalogReader, MockCatalogReader.MockSchema schema, String name, boolean stream, double rowCount, @Nullable MockCatalogReader.ColumnResolver resolver) -
create
public static MockCatalogReader.MockTable create(MockCatalogReader catalogReader, MockCatalogReader.MockSchema schema, String name, boolean stream, double rowCount, @Nullable MockCatalogReader.ColumnResolver resolver, double maxRowCount) -
create
public static MockCatalogReader.MockTable create(MockCatalogReader catalogReader, MockCatalogReader.MockSchema schema, String name, boolean stream, double rowCount, @Nullable MockCatalogReader.ColumnResolver resolver, InitializerExpressionFactory initializerExpressionFactory, boolean temporal, Double maxRowCount) -
create
public static MockCatalogReader.MockTable create(MockCatalogReader catalogReader, MockCatalogReader.MockSchema schema, String name, boolean stream, double rowCount, @Nullable MockCatalogReader.ColumnResolver resolver, InitializerExpressionFactory initializerExpressionFactory, boolean temporal) -
unwrap
Description copied from interface:WrapperFinds an instance of an interface implemented by this object, or returns null if this object does not support that interface. -
getRowCount
public double getRowCount()Description copied from interface:RelOptTableReturns an estimate of the number of rows in the table.- Specified by:
getRowCountin interfaceRelOptTable
-
getRelOptSchema
Description copied from interface:RelOptTableReturns theRelOptSchemathis table belongs to.- Specified by:
getRelOptSchemain interfaceRelOptTable
-
toRel
Description copied from interface:RelOptTableConverts this table into arelational expression.The
plannercalls this method to convert a table into an initial relational expression, generally something abstract, such as aLogicalTableScan, then optimizes this expression by applyingrulesto transform it into more efficient access methods for this table.- Specified by:
toRelin interfaceRelOptTable
-
getCollationList
Description copied from interface:RelOptTableReturns a description of the physical ordering (or orderings) of the rows returned from this table.- Specified by:
getCollationListin interfaceRelOptTable- See Also:
-
getDistribution
Description copied from interface:RelOptTableReturns a description of the physical distribution of the rows in this table.- Specified by:
getDistributionin interfaceRelOptTable- See Also:
-
isKey
Description copied from interface:RelOptTableReturns whether the given columns are a key or a superset of a unique key of this table.- Specified by:
isKeyin interfaceRelOptTable- Parameters:
columns- Ordinals of key columns- Returns:
- Whether the given columns are a key or a superset of a key
-
getKeys
Description copied from interface:RelOptTableReturns a list of unique keys, empty list if no key exist, the result should be consistent withisKey.- Specified by:
getKeysin interfaceRelOptTable
-
getReferentialConstraints
Description copied from interface:RelOptTableReturns the referential constraints existing for this table. These constraints are represented over other tables usingRelReferentialConstraintnodes.- Specified by:
getReferentialConstraintsin interfaceRelOptTable
-
getRowType
Description copied from interface:RelOptTableDescribes the type of rows returned by this table.- Specified by:
getRowTypein interfaceRelOptTable- Specified by:
getRowTypein interfaceSqlValidatorTable
-
supportsModality
- Specified by:
supportsModalityin interfaceSqlValidatorTable
-
isTemporal
public boolean isTemporal()Description copied from interface:SqlValidatorTableReturns whether the table is temporal.- Specified by:
isTemporalin interfaceSqlValidatorTable
-
onRegister
-
getQualifiedName
Description copied from interface:RelOptTableObtains an identifier for this table. The identifier must be unique with respect to the Connection producing this table.- Specified by:
getQualifiedNamein interfaceRelOptTable- Specified by:
getQualifiedNamein interfaceSqlValidatorTable- Returns:
- qualified name
-
getMonotonicity
Description copied from interface:SqlValidatorTableReturns whether a given column is monotonic.- Specified by:
getMonotonicityin interfaceSqlValidatorTable
-
getAllowedAccess
Description copied from interface:SqlValidatorTableReturns the access type of the table.- Specified by:
getAllowedAccessin interfaceSqlValidatorTable
-
getExpression
Description copied from interface:RelOptTableGenerates code for this table.- Specified by:
getExpressionin interfaceRelOptTable- Parameters:
clazz- The desired collection class; for exampleQueryable.- Returns:
- the code for the table, or null if code generation is not supported
-
addColumn
-
addColumn
-
addKey
-
addKey
-
addMonotonic
-
setKind
-
getKind
-