Interface SchemaPlus
-
- All Superinterfaces:
Schema
- All Known Implementing Classes:
CalciteSchema.SchemaPlusImpl
,RelOptTableImpl.MySchemaPlus
public interface SchemaPlus extends Schema
Extension to theSchema
interface.Given a user-defined schema that implements the
Schema
interface, Calcite creates a wrapper that implements theSchemaPlus
interface. This provides extra functionality, such as access to tables that have been added explicitly.A user-defined schema does not need to implement this interface, but by the time a schema is passed to a method in a user-defined schema or user-defined table, it will have been wrapped in this interface.
SchemaPlus is intended to be used by users but not instantiated by them. Users should only use the SchemaPlus they are given by the system. The purpose of SchemaPlus is to expose to user code, in a read only manner, some of the extra information about schemas that Calcite builds up when a schema is registered. It appears in several SPI calls as context; for example
SchemaFactory.create(SchemaPlus, String, java.util.Map)
contains a parent schema that might be a wrapped instance of a user-definedSchema
, or indeed might not.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.calcite.schema.Schema
Schema.TableType
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
add(java.lang.String name, Lattice lattice)
Adds a lattice to this schema.void
add(java.lang.String name, RelProtoDataType type)
Adds a type to this schema.void
add(java.lang.String name, Function function)
Adds a function to this schema.SchemaPlus
add(java.lang.String name, Schema schema)
Adds a schema as a sub-schema of this schema, and returns the wrapped object.void
add(java.lang.String name, Table table)
Adds a table to this schema.java.lang.String
getName()
Returns the name of this schema.SchemaPlus
getParentSchema()
Returns the parent schema, or null if this schema has no parent.SchemaPlus
getSubSchema(java.lang.String name)
Returns a sub-schema with a given name, or null.boolean
isCacheEnabled()
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 asSchema.getTable(String)
.void
setCacheEnabled(boolean cache)
void
setPath(com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableList<java.lang.String>> path)
<T> T
unwrap(java.lang.Class<T> clazz)
Returns an underlying object.-
Methods inherited from interface org.apache.calcite.schema.Schema
getExpression, getFunctionNames, getFunctions, getSubSchemaNames, getTable, getTableNames, getType, getTypeNames, snapshot
-
-
-
-
Method Detail
-
getParentSchema
SchemaPlus getParentSchema()
Returns the parent schema, or null if this schema has no parent.
-
getName
java.lang.String getName()
Returns the name of this schema.The name must not be null, and must be unique within its parent. The root schema is typically named "".
-
getSubSchema
SchemaPlus getSubSchema(java.lang.String name)
Description copied from interface:Schema
Returns a sub-schema with a given name, or null.- Specified by:
getSubSchema
in interfaceSchema
- Parameters:
name
- Sub-schema name- Returns:
- Sub-schema with a given name, or null
-
add
SchemaPlus add(java.lang.String name, Schema schema)
Adds a schema as a sub-schema of this schema, and returns the wrapped object.
-
add
void add(java.lang.String name, Table table)
Adds a table to this schema.
-
add
void add(java.lang.String name, Function function)
Adds a function to this schema.
-
add
void add(java.lang.String name, RelProtoDataType type)
Adds a type to this schema.
-
add
void add(java.lang.String name, Lattice lattice)
Adds a lattice to this schema.
-
isMutable
boolean isMutable()
Description copied from interface:Schema
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 asSchema.getTable(String)
.Even if this method returns true, the maps are not modified. Calcite stores the defined objects in a wrapper object.
-
unwrap
<T> T unwrap(java.lang.Class<T> clazz)
Returns an underlying object.
-
setPath
void setPath(com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableList<java.lang.String>> path)
-
setCacheEnabled
void setCacheEnabled(boolean cache)
-
isCacheEnabled
boolean isCacheEnabled()
-
-