public class AbstractSchema extends Object implements Schema
Schema.
Behavior is as follows:
getTableMap().getFunctionMultimap().getSubSchemaMap().isMutable().For constructing custom maps and multi-maps, we recommend
Suppliers and
Maps.
Schema.TableType| Constructor and Description |
|---|
AbstractSchema() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contentsHaveChangedSince(long lastCheck,
long now)
Returns whether the contents of this schema have changed since a given
time.
|
Expression |
getExpression(SchemaPlus parentSchema,
String name)
Returns the expression by which this schema can be referenced in generated
code.
|
protected com.google.common.collect.Multimap<String,Function> |
getFunctionMultimap()
Returns a multi-map of functions in this schema by name.
|
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.
|
Schema |
getSubSchema(String name)
Returns a sub-schema with a given name, or null.
|
protected Map<String,Schema> |
getSubSchemaMap()
Returns a map of sub-schemas in this schema by name.
|
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.
|
protected Map<String,Table> |
getTableMap()
Returns a map of tables in this schema by name.
|
Set<String> |
getTableNames()
Returns the names of the tables in this schema.
|
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). |
public 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.
public boolean contentsHaveChangedSince(long lastCheck,
long now)
SchemaSystem.currentTimeMillis(). If this method returns true, and
caching is enabled, Calcite will re-build caches.
The default implementation in
AbstractSchema always returns
false.
To control whether Calcite caches the contents of a schema, use the "cache" JSON attribute. The default value is "true".
contentsHaveChangedSince in interface SchemalastCheck - The last time that Calcite called this method, or
Long.MIN_VALUE if this is the first callnow - The current time in millis, as returned by
System.currentTimeMillis()lastCheckMillis.public Expression getExpression(SchemaPlus parentSchema, String name)
SchemagetExpression in interface SchemaparentSchema - Parent schemaname - Name of this schemaprotected Map<String,Table> getTableMap()
The implementations of getTableNames()
and getTable(String) depend on this map.
The default implementation of this method returns the empty map.
Override this method to change their behavior.
public final Set<String> getTableNames()
SchemagetTableNames in interface Schemapublic final Table getTable(String name)
Schemaprotected com.google.common.collect.Multimap<String,Function> getFunctionMultimap()
The implementations of getFunctionNames()
and Schema.getFunctions(String) depend on this map.
The default implementation of this method returns the empty multi-map.
Override this method to change their behavior.
public final Collection<Function> getFunctions(String name)
SchemagetFunctions in interface Schemaname - Name of functionpublic final Set<String> getFunctionNames()
SchemagetFunctionNames in interface Schemaprotected Map<String,Schema> getSubSchemaMap()
The implementations of getSubSchemaNames()
and getSubSchema(String) depend on this map.
The default implementation of this method returns the empty map.
Override this method to change their behavior.
public final Set<String> getSubSchemaNames()
SchemagetSubSchemaNames in interface Schemapublic final Schema getSubSchema(String name)
SchemagetSubSchema in interface Schemaname - Sub-schema nameCopyright © 2012–2015 The Apache Software Foundation. All rights reserved.