Package org.apache.calcite.test.catalog
Class MockCatalogReader
- java.lang.Object
-
- org.apache.calcite.prepare.CalciteCatalogReader
-
- org.apache.calcite.test.catalog.MockCatalogReader
-
- All Implemented Interfaces:
org.apache.calcite.plan.RelOptSchema
,org.apache.calcite.prepare.Prepare.CatalogReader
,org.apache.calcite.schema.Wrapper
,org.apache.calcite.sql.SqlOperatorTable
,org.apache.calcite.sql.validate.SqlValidatorCatalogReader
- Direct Known Subclasses:
MockCatalogReaderDynamic
,MockCatalogReaderSimple
public abstract class MockCatalogReader extends org.apache.calcite.prepare.CalciteCatalogReader
Mock implementation ofSqlValidatorCatalogReader
which returns tables "EMP", "DEPT", "BONUS", "SALGRADE" (same as Oracle's SCOTT schema). Also two streams "ORDERS", "SHIPMENTS"; and a view "EMP_20".
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
MockCatalogReader.ColumnResolver
Column resolverprivate static class
MockCatalogReader.DelegateStructType
Struct type based on another struct type.static class
MockCatalogReader.MockDynamicTable
Mock implementation ofPrepare.PreparingTable
with dynamic record type.static class
MockCatalogReader.MockModifiableViewRelOptTable
Alternative to MockViewTable that exercises code paths in ModifiableViewTable and ModifiableViewTableInitializerExpressionFactory.static class
MockCatalogReader.MockSchema
Mock schema.static class
MockCatalogReader.MockTable
Mock implementation ofPrepare.PreparingTable
.static class
MockCatalogReader.MockViewTable
Mock implementation ofPrepare.PreparingTable
for views.private static class
MockCatalogReader.StreamableWrapperTable
Wrapper around aMockCatalogReader.MockTable
, giving it aStreamableTable
interface.private static class
MockCatalogReader.WrapperTable
Wrapper around aMockCatalogReader.MockTable
, giving it aTable
interface.
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.String
DEFAULT_CATALOG
(package private) static java.lang.String
DEFAULT_SCHEMA
(package private) static java.util.List<java.lang.String>
PREFIX
-
Constructor Summary
Constructors Constructor Description MockCatalogReader(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory, boolean caseSensitive)
Creates a MockCatalogReader.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private static java.util.List<org.apache.calcite.rel.RelCollation>
deduceMonotonicity(org.apache.calcite.prepare.Prepare.PreparingTable table)
abstract MockCatalogReader
init()
Initializes this catalog reader.boolean
isCaseSensitive()
org.apache.calcite.sql.validate.SqlNameMatcher
nameMatcher()
private void
registerNestedSchema(MockCatalogReader.MockSchema parentSchema, MockCatalogReader.MockSchema schema)
protected void
registerSchema(MockCatalogReader.MockSchema schema)
private void
registerTable(java.util.List<java.lang.String> names, org.apache.calcite.schema.Table table)
protected void
registerTable(MockCatalogReader.MockTable table)
protected void
registerTablesWithRollUp(MockCatalogReader.MockSchema schema, Fixture f)
protected void
registerType(java.util.List<java.lang.String> names, org.apache.calcite.rel.type.RelProtoDataType relProtoDataType)
-
Methods inherited from class org.apache.calcite.prepare.CalciteCatalogReader
createTypeFromProjection, field, getAllSchemaObjectNames, getConfig, getNamedType, getOperatorList, getRootSchema, getSchemaPaths, getTable, getTableForMember, getTypeFactory, lookupOperatorOverloads, matches, operatorTable, registerRules, unwrap, withSchemaPath
-
-
-
-
Field Detail
-
DEFAULT_CATALOG
static final java.lang.String DEFAULT_CATALOG
- See Also:
- Constant Field Values
-
DEFAULT_SCHEMA
static final java.lang.String DEFAULT_SCHEMA
- See Also:
- Constant Field Values
-
PREFIX
static final java.util.List<java.lang.String> PREFIX
-
-
Constructor Detail
-
MockCatalogReader
public MockCatalogReader(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory, boolean caseSensitive)
Creates a MockCatalogReader.Caller must then call
init()
to populate with data.- Parameters:
typeFactory
- Type factory
-
-
Method Detail
-
isCaseSensitive
public boolean isCaseSensitive()
- Specified by:
isCaseSensitive
in interfaceorg.apache.calcite.sql.validate.SqlValidatorCatalogReader
- Overrides:
isCaseSensitive
in classorg.apache.calcite.prepare.CalciteCatalogReader
-
nameMatcher
public org.apache.calcite.sql.validate.SqlNameMatcher nameMatcher()
- Specified by:
nameMatcher
in interfaceorg.apache.calcite.sql.validate.SqlValidatorCatalogReader
- Overrides:
nameMatcher
in classorg.apache.calcite.prepare.CalciteCatalogReader
-
init
public abstract MockCatalogReader init()
Initializes this catalog reader.
-
registerTablesWithRollUp
protected void registerTablesWithRollUp(MockCatalogReader.MockSchema schema, Fixture f)
-
registerType
protected void registerType(java.util.List<java.lang.String> names, org.apache.calcite.rel.type.RelProtoDataType relProtoDataType)
-
registerTable
protected void registerTable(MockCatalogReader.MockTable table)
-
registerTable
private void registerTable(java.util.List<java.lang.String> names, org.apache.calcite.schema.Table table)
-
registerSchema
protected void registerSchema(MockCatalogReader.MockSchema schema)
-
registerNestedSchema
private void registerNestedSchema(MockCatalogReader.MockSchema parentSchema, MockCatalogReader.MockSchema schema)
-
deduceMonotonicity
private static java.util.List<org.apache.calcite.rel.RelCollation> deduceMonotonicity(org.apache.calcite.prepare.Prepare.PreparingTable table)
-
-