public class CalciteCatalogReader extends Object implements Prepare.CatalogReader
Prepare.CatalogReader
and also SqlOperatorTable based on tables and
functions defined schemas.| Modifier and Type | Field and Description |
|---|---|
protected CalciteConnectionConfig |
config |
protected SqlNameMatcher |
nameMatcher |
protected CalciteSchema |
rootSchema |
protected RelDataTypeFactory |
typeFactory |
THREAD_LOCAL| Modifier | Constructor and Description |
|---|---|
|
CalciteCatalogReader(CalciteSchema rootSchema,
List<String> defaultSchema,
RelDataTypeFactory typeFactory,
CalciteConnectionConfig config) |
protected |
CalciteCatalogReader(CalciteSchema rootSchema,
SqlNameMatcher nameMatcher,
List<List<String>> schemaPaths,
RelDataTypeFactory typeFactory,
CalciteConnectionConfig config) |
| Modifier and Type | Method and Description |
|---|---|
RelDataType |
createTypeFromProjection(RelDataType type,
List<String> columnNameList) |
@Nullable RelDataTypeField |
field(RelDataType rowType,
String alias) |
List<SqlMoniker> |
getAllSchemaObjectNames(List<String> names)
Given fully qualified schema name, returns schema object names as
specified.
|
CalciteConnectionConfig |
getConfig()
Returns Config settings.
|
@Nullable 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.
|
CalciteSchema |
getRootSchema()
Returns the root namespace for name resolution.
|
List<List<String>> |
getSchemaPaths()
Returns the paths of all schemas to look in for tables.
|
Prepare.PreparingTable |
getTable(List<String> names)
Finds a table or schema with the given name, possibly qualified.
|
Prepare.PreparingTable |
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. |
boolean |
isCaseSensitive() |
void |
lookupOperatorOverloads(SqlIdentifier opName,
@Nullable SqlFunctionCategory category,
SqlSyntax syntax,
List<SqlOperator> operatorList,
SqlNameMatcher nameMatcher)
Retrieves a list of operators with a given name and syntax.
|
boolean |
matches(String string,
String name) |
SqlNameMatcher |
nameMatcher()
Returns an implementation of
SqlNameMatcher
that matches the case-sensitivity policy. |
static SqlOperatorTable |
operatorTable(String... classNames)
Creates an operator table that contains functions in the given class
or classes.
|
void |
registerRules(RelOptPlanner planner)
Registers all of the rules supported by this schema.
|
<C> C |
unwrap(Class<C> aClass)
Finds an instance of an interface implemented by this object,
or returns null if this object does not support that interface.
|
CalciteCatalogReader |
withSchemaPath(List<String> schemaPath)
Returns a catalog reader the same as this one but with a possibly
different schema path.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitmaybeUnwrap, unwrapOrThrowprotected final CalciteSchema rootSchema
protected final RelDataTypeFactory typeFactory
protected final SqlNameMatcher nameMatcher
protected final CalciteConnectionConfig config
public CalciteCatalogReader(CalciteSchema rootSchema, List<String> defaultSchema, RelDataTypeFactory typeFactory, CalciteConnectionConfig config)
protected CalciteCatalogReader(CalciteSchema rootSchema, SqlNameMatcher nameMatcher, List<List<String>> schemaPaths, RelDataTypeFactory typeFactory, CalciteConnectionConfig config)
public CalciteCatalogReader withSchemaPath(List<String> schemaPath)
Prepare.CatalogReaderwithSchemaPath in interface Prepare.CatalogReaderpublic Prepare.PreparingTable getTable(List<String> names)
SqlValidatorCatalogReaderUses the case-sensitivity policy of the catalog reader.
If not found, returns null. If you want a more descriptive error
message or to override the case-sensitivity of the match, use
SqlValidatorScope.resolveTable(java.util.List<java.lang.String>, org.apache.calcite.sql.validate.SqlNameMatcher, org.apache.calcite.sql.validate.SqlValidatorScope.Path, org.apache.calcite.sql.validate.SqlValidatorScope.Resolved).
getTable in interface Prepare.CatalogReadergetTable in interface SqlValidatorCatalogReadernames - Name of table, may be qualified or fully-qualifiedpublic CalciteConnectionConfig getConfig()
SqlValidatorCatalogReadergetConfig in interface SqlValidatorCatalogReaderpublic @Nullable 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<List<String>> getSchemaPaths()
SqlValidatorCatalogReadergetSchemaPaths in interface SqlValidatorCatalogReaderpublic Prepare.PreparingTable 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 @Nullable RelDataTypeField field(RelDataType rowType, String alias)
field in interface SqlValidatorCatalogReaderpublic boolean matches(String string, String name)
matches in interface SqlValidatorCatalogReaderpublic RelDataType createTypeFromProjection(RelDataType type, List<String> columnNameList)
createTypeFromProjection in interface SqlValidatorCatalogReaderpublic void lookupOperatorOverloads(SqlIdentifier opName, @Nullable SqlFunctionCategory category, SqlSyntax syntax, List<SqlOperator> operatorList, SqlNameMatcher nameMatcher)
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 matchesnameMatcher - Name matcherpublic static SqlOperatorTable operatorTable(String... classNames)
public List<SqlOperator> getOperatorList()
SqlOperatorTablegetOperatorList in interface SqlOperatorTablepublic CalciteSchema getRootSchema()
SqlValidatorCatalogReadergetRootSchema in interface SqlValidatorCatalogReaderpublic RelDataTypeFactory getTypeFactory()
RelOptSchematype factory used to generate
types for this schema.getTypeFactory in interface RelOptSchemapublic void registerRules(RelOptPlanner planner)
RelOptSchemaRelOptPlanner.registerSchema(org.apache.calcite.plan.RelOptSchema).registerRules in interface RelOptSchemapublic boolean isCaseSensitive()
isCaseSensitive in interface SqlValidatorCatalogReaderpublic SqlNameMatcher nameMatcher()
SqlValidatorCatalogReaderSqlNameMatcher
that matches the case-sensitivity policy.nameMatcher in interface SqlValidatorCatalogReaderCopyright © 2012-2022 Apache Software Foundation. All Rights Reserved.