public abstract class AbstractSchema extends Object implements org.apache.calcite.schema.Schema, SchemaPartitionExplorer, AutoCloseable
| Modifier and Type | Field and Description |
|---|---|
protected String |
name |
static String |
SCHEMA_SEPARATOR |
protected List<String> |
schemaPath |
| Constructor and Description |
|---|
AbstractSchema(List<String> parentSchemaPath,
String name) |
| Modifier and Type | Method and Description |
|---|---|
CreateTableEntry |
appendToStatsTable(String tableName)
Create an append statistics table entry for given tableName.
|
DrillTable |
applyFunctionParameters(DrillTable drillTable,
List<TableParamDef> paramDefs,
List<Object> values)
For the given list of parameters definitions executes action for the corresponding value.
|
boolean |
areTableNamesCaseSensitive()
Indicates if table names in schema are case sensitive.
|
void |
close() |
CreateTableEntry |
createNewTable(String tableName,
List<String> partitionColumns)
Creates table entry using table name and list of partition columns if any.
|
CreateTableEntry |
createNewTable(String tableName,
List<String> partitionColumns,
StorageStrategy storageStrategy)
Creates table entry using table name, list of partition columns
and storage strategy used to create table folder and files
|
CreateTableEntry |
createStatsTable(String tableName)
Create stats table entry for given tableName.
|
boolean |
createView(View view)
Create a new view given definition.
|
void |
dropTable(String tableName) |
void |
dropView(String viewName)
Drop the view with given name.
|
org.apache.calcite.schema.Schema |
getDefaultSchema()
The schema can be a top level schema which doesn't have its own tables, but refers
to one of the default sub schemas for table look up.
|
org.apache.calcite.linq4j.tree.Expression |
getExpression(org.apache.calcite.schema.SchemaPlus parentSchema,
String name) |
String |
getFullSchemaName() |
Set<String> |
getFunctionNames() |
List<TableParamDef> |
getFunctionParameters()
Returns of common table function parameters that can be used all Drill schema implementations.
|
Collection<org.apache.calcite.schema.Function> |
getFunctions(String name)
For the given table names returns list of acceptable table functions
which are common for all Drill schemas.
|
String |
getName() |
List<String> |
getSchemaPath() |
org.apache.calcite.schema.Table |
getStatsTable(String tableName)
Get the statistics table for given tableName
|
Iterable<String> |
getSubPartitions(String table,
List<String> partitionColumns,
List<String> partitionValues)
Get a list of sub-partitions of a particular table and the partitions
specified by partition columns and values.
|
org.apache.calcite.schema.Schema |
getSubSchema(String name) |
Set<String> |
getSubSchemaNames() |
org.apache.calcite.schema.Table |
getTable(String name) |
Set<String> |
getTableNames() |
Collection<Map.Entry<String,org.apache.calcite.schema.Schema.TableType>> |
getTableNamesAndTypes()
Used by
InfoSchemaRecordGenerator.Tables
for getting all table objects along with type for every requested schema. |
List<org.apache.commons.lang3.tuple.Pair<String,? extends org.apache.calcite.schema.Table>> |
getTablesByNames(Set<String> tableNames)
Get the collection of
Table tables specified in the tableNames. |
org.apache.calcite.rel.type.RelProtoDataType |
getType(String name) |
protected Map<String,org.apache.calcite.rel.type.RelProtoDataType> |
getTypeMap()
Returns a map of types in this schema by name.
|
abstract String |
getTypeName()
Returns string describing schema type which shows where the schema came from.
|
Set<String> |
getTypeNames() |
boolean |
isMutable() |
boolean |
showInInformationSchema()
Reports whether to show items from this schema in INFORMATION_SCHEMA
tables.
|
org.apache.calcite.schema.Schema |
snapshot(org.apache.calcite.schema.SchemaVersion version) |
String |
toString() |
public static final String SCHEMA_SEPARATOR
protected final String name
public Iterable<String> getSubPartitions(String table, List<String> partitionColumns, List<String> partitionValues) throws PartitionNotFoundException
SchemaPartitionExplorer
For more info see docs in PartitionExplorer.
getSubPartitions in interface SchemaPartitionExplorerpartitionColumns - a list of partitions to matchpartitionValues - list of values of each partition (corresponding
to the partition column list)PartitionNotFoundException - when the partition does not exist in
the given workspacepublic String getName()
public String getFullSchemaName()
public abstract String getTypeName()
public org.apache.calcite.schema.Schema getDefaultSchema()
Default implementation returns itself.
Ex. "dfs" schema refers to the tables in "default" workspace when querying for tables in "dfs" schema.
public boolean createView(View view) throws IOException
view - View info including name, definition etc.IOException - in case of error creating a viewpublic void dropView(String viewName) throws IOException
viewName - view nameIOException - in case of error dropping the viewpublic CreateTableEntry createNewTable(String tableName, List<String> partitionColumns, StorageStrategy storageStrategy)
tableName - : new table name.partitionColumns - : list of partition columns. Empty list if there is no partition columns.storageStrategy - : storage strategy used to create table folder and filespublic CreateTableEntry createNewTable(String tableName, List<String> partitionColumns)
tableName - : new table name.partitionColumns - : list of partition columns. Empty list if there is no partition columns.public CreateTableEntry createStatsTable(String tableName)
tableName - table namepublic CreateTableEntry appendToStatsTable(String tableName)
tableName - table namepublic org.apache.calcite.schema.Table getStatsTable(String tableName)
tableName - table namepublic boolean showInInformationSchema()
This base implementation returns true.
public Collection<org.apache.calcite.schema.Function> getFunctions(String name)
getFunctions in interface org.apache.calcite.schema.Schemaname - table namepublic List<TableParamDef> getFunctionParameters()
public DrillTable applyFunctionParameters(DrillTable drillTable, List<TableParamDef> paramDefs, List<Object> values)
drillTable - Drill table instanceparamDefs - parameter definitionsvalues - parameter valuesprotected Map<String,org.apache.calcite.rel.type.RelProtoDataType> getTypeMap()
The implementations of getTypeNames()
and getType(String) depend on this map.
The default implementation of this method returns the empty map.
Override this method to change their behavior.
public Set<String> getTypeNames()
getTypeNames in interface org.apache.calcite.schema.Schemapublic org.apache.calcite.rel.type.RelProtoDataType getType(String name)
getType in interface org.apache.calcite.schema.Schemapublic Set<String> getFunctionNames()
getFunctionNames in interface org.apache.calcite.schema.Schemapublic org.apache.calcite.schema.Schema getSubSchema(String name)
getSubSchema in interface org.apache.calcite.schema.Schemapublic Set<String> getSubSchemaNames()
getSubSchemaNames in interface org.apache.calcite.schema.Schemapublic boolean isMutable()
isMutable in interface org.apache.calcite.schema.Schemapublic org.apache.calcite.schema.Table getTable(String name)
getTable in interface org.apache.calcite.schema.Schemapublic Set<String> getTableNames()
getTableNames in interface org.apache.calcite.schema.Schemapublic org.apache.calcite.linq4j.tree.Expression getExpression(org.apache.calcite.schema.SchemaPlus parentSchema,
String name)
getExpression in interface org.apache.calcite.schema.Schemapublic void close()
throws Exception
close in interface AutoCloseableExceptionpublic org.apache.calcite.schema.Schema snapshot(org.apache.calcite.schema.SchemaVersion version)
snapshot in interface org.apache.calcite.schema.Schemapublic void dropTable(String tableName)
public List<org.apache.commons.lang3.tuple.Pair<String,? extends org.apache.calcite.schema.Table>> getTablesByNames(Set<String> tableNames)
Table tables specified in the tableNames.tableNames - the requested tables, specified by the table namespublic Collection<Map.Entry<String,org.apache.calcite.schema.Schema.TableType>> getTableNamesAndTypes()
InfoSchemaRecordGenerator.Tables
for getting all table objects along with type for every requested schema. It's desired
for this method to work fast because it impacts SHOW TABLES query.public boolean areTableNamesCaseSensitive()
Copyright © 2021 The Apache Software Foundation. All rights reserved.