Interface Schema
- All Known Subinterfaces:
SchemaPlus
,SemiMutableSchema
- All Known Implementing Classes:
AbstractSchema
,CassandraSchema
,CloneSchema
,CsvSchema
,DelegatingSchema
,DruidSchema
,ElasticsearchSchema
,GeodeSchema
,GeodeSimpleSchema
,InnodbSchema
,JdbcCatalogSchema
,JdbcSchema
,MongoSchema
,PigSchema
,ReflectiveSchema
,ReflectiveSchemaWithoutRowCount
,SplunkSchema
,TpcdsSchema
,TpchSchema
A schema can also contain sub-schemas, to any level of nesting. Most providers have a limited number of levels; for example, most JDBC databases have either one level ("schemas") or two levels ("database" and "catalog").
There may be multiple overloaded functions with the same name but
different numbers or types of parameters.
For this reason, getFunctions(java.lang.String)
returns a list of all
members with the same name. Calcite will call
Schemas.resolve(org.apache.calcite.rel.type.RelDataTypeFactory, String, java.util.Collection, java.util.List)
to choose the appropriate one.
The most common and important type of member is the one with no arguments and a result type that is a collection of records. This is called a relation. It is equivalent to a table in a relational database.
For example, the query
select * from sales.emps
is valid if "sales" is a registered
schema and "emps" is a member with zero parameters and a result type
of Collection(Record(int: "empno", String: "name"))
.
A schema may be nested within another schema; see
getSubSchema(String)
.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetExpression
(@Nullable SchemaPlus parentSchema, String name) Returns the expression by which this schema can be referenced in generated code.Returns the names of the functions in this schema.getFunctions
(String name) Returns a list of functions in this schema with the given name, or an empty list if there is no such function.@Nullable Schema
getSubSchema
(String name) Returns a sub-schema with a given name, or null.Returns the names of this schema's child schemas.@Nullable Table
Returns a table with a given name, or null if not found.Returns the names of the tables in this schema.@Nullable RelProtoDataType
Returns a type with a given name, or null if not found.Returns the names of the types in this schema.boolean
Returns whether the user is allowed to create new tables, functions and sub-schemas in this schema, in addition to those returned automatically by methods such asgetTable(String)
.snapshot
(SchemaVersion version) Returns the snapshot of this schema as of the specified time.
-
Method Details
-
getTable
Returns a table with a given name, or null if not found.- Parameters:
name
- Table name- Returns:
- Table, or null
-
getTableNames
Returns the names of the tables in this schema.- Returns:
- Names of the tables in this schema
-
getType
Returns a type with a given name, or null if not found.- Parameters:
name
- Table name- Returns:
- Table, or null
-
getTypeNames
Returns the names of the types in this schema.- Returns:
- Names of the tables in this schema
-
getFunctions
Returns a list of functions in this schema with the given name, or an empty list if there is no such function.- Parameters:
name
- Name of function- Returns:
- List of functions with given name, or empty list
-
getFunctionNames
Returns the names of the functions in this schema.- Returns:
- Names of the functions in this schema
-
getSubSchema
Returns a sub-schema with a given name, or null.- Parameters:
name
- Sub-schema name- Returns:
- Sub-schema with a given name, or null
-
getSubSchemaNames
Returns the names of this schema's child schemas.- Returns:
- Names of this schema's child schemas
-
getExpression
Returns the expression by which this schema can be referenced in generated code.- Parameters:
parentSchema
- Parent schemaname
- Name of this schema- Returns:
- Expression by which this schema can be referenced in generated code
-
isMutable
boolean isMutable()Returns whether the user is allowed to create new tables, functions and sub-schemas in this schema, in addition to those returned automatically by methods such asgetTable(String)
.Even if this method returns true, the maps are not modified. Calcite stores the defined objects in a wrapper object.
- Returns:
- Whether the user is allowed to create new tables, functions and sub-schemas in this schema
-
snapshot
Returns the snapshot of this schema as of the specified time. The contents of the schema snapshot should not change over time.- Parameters:
version
- The current schema version- Returns:
- the schema snapshot.
-