private static class RelOptTableImpl.MySchemaPlus extends Object implements SchemaPlus
SchemaPlus that wraps a regular schema and knows
its name and parent.
It is read-only, and functionality is limited in other ways, it but allows table expressions to be generated.
Schema.TableType| Modifier and Type | Field and Description |
|---|---|
private String |
name |
private SchemaPlus |
parent |
private Schema |
schema |
| Constructor and Description |
|---|
MySchemaPlus(SchemaPlus parent,
String name,
Schema schema) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(String name,
Function function)
Adds a function to this schema.
|
void |
add(String name,
Lattice lattice)
Adds a lattice to this schema.
|
SchemaPlus |
add(String name,
Schema schema)
Adds a schema as a sub-schema of this schema, and returns the wrapped
object.
|
void |
add(String name,
Table table)
Adds a table to this schema.
|
static RelOptTableImpl.MySchemaPlus |
create(Path path) |
Expression |
getExpression(SchemaPlus parentSchema,
String name)
Returns the expression by which this schema can be referenced in generated
code.
|
Set<String> |
getFunctionNames()
Returns the names of the functions in this schema.
|
Collection<Function> |
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.
|
String |
getName()
Returns the name of this schema.
|
SchemaPlus |
getParentSchema()
Returns the parent schema, or null if this schema has no parent.
|
SchemaPlus |
getSubSchema(String name)
Returns a sub-schema with a given name, or null.
|
Set<String> |
getSubSchemaNames()
Returns the names of this schema's child schemas.
|
Table |
getTable(String name)
Returns a table with a given name, or null if not found.
|
Set<String> |
getTableNames()
Returns the names of the tables in this schema.
|
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 as
Schema.getTable(String). |
void |
setCacheEnabled(boolean cache) |
void |
setPath(com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableList<String>> path) |
Schema |
snapshot(SchemaVersion version)
Returns the snapshot of this schema as of the specified time.
|
<T> T |
unwrap(Class<T> clazz)
Returns an underlying object.
|
private final SchemaPlus parent
private final String name
private final Schema schema
MySchemaPlus(SchemaPlus parent, String name, Schema schema)
public static RelOptTableImpl.MySchemaPlus create(Path path)
public SchemaPlus getParentSchema()
SchemaPlusgetParentSchema in interface SchemaPluspublic String getName()
SchemaPlusThe name must not be null, and must be unique within its parent. The root schema is typically named "".
getName in interface SchemaPluspublic SchemaPlus getSubSchema(String name)
SchemagetSubSchema in interface SchemagetSubSchema in interface SchemaPlusname - Sub-schema namepublic SchemaPlus add(String name, Schema schema)
SchemaPlusadd in interface SchemaPluspublic void add(String name, Table table)
SchemaPlusadd in interface SchemaPluspublic void add(String name, Function function)
SchemaPlusadd in interface SchemaPluspublic void add(String name, Lattice lattice)
SchemaPlusadd in interface SchemaPluspublic boolean isMutable()
SchemaSchema.getTable(String).
Even if this method returns true, the maps are not modified. Calcite stores the defined objects in a wrapper object.
isMutable in interface SchemaisMutable in interface SchemaPluspublic <T> T unwrap(Class<T> clazz)
SchemaPlusunwrap in interface SchemaPluspublic void setPath(com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableList<String>> path)
setPath in interface SchemaPluspublic void setCacheEnabled(boolean cache)
setCacheEnabled in interface SchemaPluspublic boolean isCacheEnabled()
isCacheEnabled in interface SchemaPluspublic Table getTable(String name)
Schemapublic Set<String> getTableNames()
SchemagetTableNames in interface Schemapublic Collection<Function> getFunctions(String name)
SchemagetFunctions in interface Schemaname - Name of functionpublic Set<String> getFunctionNames()
SchemagetFunctionNames in interface Schemapublic Set<String> getSubSchemaNames()
SchemagetSubSchemaNames in interface Schemapublic Expression getExpression(SchemaPlus parentSchema, String name)
SchemagetExpression in interface SchemaparentSchema - Parent schemaname - Name of this schemapublic Schema snapshot(SchemaVersion version)
SchemaCopyright © 2012–2018 The Apache Software Foundation. All rights reserved.