public class CalciteCatalogReader extends Object implements Prepare.CatalogReader, SqlOperatorTable
Prepare.CatalogReader
and also SqlOperatorTable based on tables and
functions defined schemas.| Constructor and Description |
|---|
CalciteCatalogReader(CalciteSchema rootSchema,
boolean caseSensitive,
List<String> defaultSchema,
JavaTypeFactory typeFactory) |
| Modifier and Type | Method and Description |
|---|---|
RelDataType |
createTypeFromProjection(RelDataType type,
List<String> columnNameList) |
RelDataTypeField |
field(RelDataType rowType,
String alias)
Finds a field with a given name, using the case-sensitivity of the current
session.
|
int |
fieldOrdinal(RelDataType rowType,
String alias)
Finds the ordinal of a field with a given name, using the case-sensitivity
of the current session.
|
List<SqlMoniker> |
getAllSchemaObjectNames(List<String> names)
Given fully qualified schema name, returns schema object names as
specified.
|
RelDataType |
getNamedType(SqlIdentifier typeName)
Finds a user-defined type with the given name, possibly qualified.
|
List<SqlOperator> |
getOperatorList()
Retrieves a list of all functions and operators in this table.
|
List<String> |
getSchemaName()
Returns the name of the current schema.
|
RelOptTableImpl |
getTable(List<String> names)
Finds a table with the given name, possibly qualified.
|
RelOptTableImpl |
getTableForMember(List<String> names)
Retrieves a
RelOptTable based upon a member access. |
RelDataTypeFactory |
getTypeFactory()
Returns the
type factory used to generate
types for this schema. |
void |
lookupOperatorOverloads(SqlIdentifier opName,
SqlFunctionCategory category,
SqlSyntax syntax,
List<SqlOperator> operatorList)
Retrieves a list of operators with a given name and syntax.
|
int |
match(List<String> strings,
String name) |
boolean |
matches(String string,
String name) |
void |
registerRules(RelOptPlanner planner)
Registers all of the rules supported by this schema.
|
CalciteCatalogReader |
withSchemaPath(List<String> schemaPath)
Returns a catalog reader the same as this one but with a possibly
different schema path.
|
public CalciteCatalogReader(CalciteSchema rootSchema, boolean caseSensitive, List<String> defaultSchema, JavaTypeFactory typeFactory)
public CalciteCatalogReader withSchemaPath(List<String> schemaPath)
Prepare.CatalogReaderwithSchemaPath in interface Prepare.CatalogReaderpublic RelOptTableImpl getTable(List<String> names)
SqlValidatorCatalogReadergetTable in interface Prepare.CatalogReadergetTable in interface SqlValidatorCatalogReadernames - Qualified name of tablepublic RelDataType getNamedType(SqlIdentifier typeName)
SqlValidatorCatalogReaderNOTE jvs 12-Feb-2005: the reason this method is defined here instead of on RelDataTypeFactory is that it has to take into account context-dependent information such as SQL schema path, whereas a type factory is context-independent.
getNamedType in interface SqlValidatorCatalogReadertypeName - Name of typepublic List<SqlMoniker> getAllSchemaObjectNames(List<String> names)
SqlValidatorCatalogReadergetAllSchemaObjectNames in interface SqlValidatorCatalogReadernames - the array contains fully qualified schema name or empty
list for root schemapublic List<String> getSchemaName()
SqlValidatorCatalogReadergetSchemaName in interface SqlValidatorCatalogReaderpublic RelOptTableImpl getTableForMember(List<String> names)
RelOptSchemaRelOptTable based upon a member access.
For example, the Saffron expression salesSchema.emps
would be resolved using a call to salesSchema.getTableForMember(new
String[]{"emps" }).
Note that name.length is only greater than 1 for queries originating from JDBC.
getTableForMember in interface RelOptSchemagetTableForMember in interface Prepare.CatalogReadernames - Qualified namepublic RelDataTypeField field(RelDataType rowType, String alias)
SqlValidatorCatalogReaderfield in interface SqlValidatorCatalogReaderpublic int fieldOrdinal(RelDataType rowType, String alias)
SqlValidatorCatalogReaderfieldOrdinal in interface SqlValidatorCatalogReaderpublic boolean matches(String string, String name)
matches in interface SqlValidatorCatalogReaderpublic int match(List<String> strings, String name)
match in interface SqlValidatorCatalogReaderpublic RelDataType createTypeFromProjection(RelDataType type, List<String> columnNameList)
createTypeFromProjection in interface SqlValidatorCatalogReaderpublic void lookupOperatorOverloads(SqlIdentifier opName, SqlFunctionCategory category, SqlSyntax syntax, List<SqlOperator> operatorList)
SqlOperatorTablelookupOperatorOverloads in interface SqlOperatorTableopName - name of operatorcategory - function category to look up, or null for any matching
operatorsyntax - syntax type of operatoroperatorList - mutable list to which to append matchespublic List<SqlOperator> getOperatorList()
SqlOperatorTablegetOperatorList in interface SqlOperatorTablepublic RelDataTypeFactory getTypeFactory()
RelOptSchematype factory used to generate
types for this schema.getTypeFactory in interface RelOptSchemapublic void registerRules(RelOptPlanner planner) throws Exception
RelOptSchemaRelOptPlanner.registerSchema(org.apache.calcite.plan.RelOptSchema).registerRules in interface RelOptSchemaExceptionCopyright © 2012–2015 The Apache Software Foundation. All rights reserved.