public class WorkspaceSchemaFactory.WorkspaceSchema extends AbstractSchema implements ExpandingConcurrentMap.MapValueFactory<WorkspaceSchemaFactory.TableInstance,DrillTable>
name, SCHEMA_SEPARATOR, schemaPath
Constructor and Description |
---|
WorkspaceSchema(List<String> parentSchemaPath,
String wsName,
SchemaConfig schemaConfig,
DrillFileSystem fs) |
Modifier and Type | Method and Description |
---|---|
CreateTableEntry |
appendToStatsTable(String tableName)
Create an append statistics table entry for given tableName.
|
DrillTable |
create(WorkspaceSchemaFactory.TableInstance key) |
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 |
destroy(DrillTable value) |
void |
dropTable(String table)
We check if the table contains homogeneous file formats that Drill can read.
|
void |
dropView(String viewName)
Drop the view with given name.
|
String |
getDefaultLocation() |
DrillFileSystem |
getFS() |
Set<String> |
getFunctionNames() |
List<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.
|
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.Table |
getTable(String tableName) |
Set<String> |
getTableNames() |
List<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. |
String |
getTypeName()
Returns string describing schema type which shows where the schema came from.
|
boolean |
isMutable() |
applyFunctionParameters, areTableNamesCaseSensitive, close, createNewTable, getDefaultSchema, getExpression, getFullSchemaName, getFunctionParameters, getName, getSchemaPath, getSubSchema, getSubSchemaNames, getTablesByNames, getType, getTypeMap, getTypeNames, getUser, needToImpersonateReadingData, showInInformationSchema, snapshot, toString
public WorkspaceSchema(List<String> parentSchemaPath, String wsName, SchemaConfig schemaConfig, DrillFileSystem fs)
public boolean createView(View view) throws IOException
AbstractSchema
createView
in class AbstractSchema
view
- View info including name, definition etc.IOException
- in case of error creating a viewpublic Iterable<String> getSubPartitions(String table, List<String> partitionColumns, List<String> partitionValues) throws PartitionNotFoundException
SchemaPartitionExplorer
For more info see docs in PartitionExplorer
.
getSubPartitions
in interface SchemaPartitionExplorer
getSubPartitions
in class AbstractSchema
partitionColumns
- 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 void dropView(String viewName) throws IOException
AbstractSchema
dropView
in class AbstractSchema
viewName
- view nameIOException
- in case of error dropping the viewpublic Set<String> getTableNames()
getTableNames
in interface org.apache.calcite.schema.Schema
getTableNames
in class AbstractSchema
public Set<String> getFunctionNames()
getFunctionNames
in interface org.apache.calcite.schema.Schema
getFunctionNames
in class AbstractSchema
public List<org.apache.calcite.schema.Function> getFunctions(String name)
AbstractSchema
getFunctions
in interface org.apache.calcite.schema.Schema
getFunctions
in class AbstractSchema
name
- table namepublic org.apache.calcite.schema.Table getTable(String tableName)
getTable
in interface org.apache.calcite.schema.Schema
getTable
in class AbstractSchema
public boolean isMutable()
isMutable
in interface org.apache.calcite.schema.Schema
isMutable
in class AbstractSchema
public DrillFileSystem getFS()
public String getDefaultLocation()
public CreateTableEntry createNewTable(String tableName, List<String> partitionColumns, StorageStrategy storageStrategy)
AbstractSchema
createNewTable
in class AbstractSchema
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 createStatsTable(String tableName)
AbstractSchema
createStatsTable
in class AbstractSchema
tableName
- table namepublic CreateTableEntry appendToStatsTable(String tableName)
AbstractSchema
appendToStatsTable
in class AbstractSchema
tableName
- table namepublic org.apache.calcite.schema.Table getStatsTable(String tableName)
AbstractSchema
getStatsTable
in class AbstractSchema
tableName
- table namepublic String getTypeName()
AbstractSchema
getTypeName
in class AbstractSchema
public DrillTable create(WorkspaceSchemaFactory.TableInstance key)
create
in interface ExpandingConcurrentMap.MapValueFactory<WorkspaceSchemaFactory.TableInstance,DrillTable>
public void destroy(DrillTable value)
destroy
in interface ExpandingConcurrentMap.MapValueFactory<WorkspaceSchemaFactory.TableInstance,DrillTable>
public void dropTable(String table)
dropTable
in class AbstractSchema
table
- - Path of table to be droppedpublic List<Map.Entry<String,org.apache.calcite.schema.Schema.TableType>> getTableNamesAndTypes()
AbstractSchema
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.getTableNamesAndTypes
in class AbstractSchema
Copyright © 1970 The Apache Software Foundation. All rights reserved.