Package org.apache.drill.exec.store.dfs
Class WorkspaceSchemaFactory.WorkspaceSchema
java.lang.Object
org.apache.drill.exec.store.AbstractSchema
org.apache.drill.exec.store.dfs.WorkspaceSchemaFactory.WorkspaceSchema
- All Implemented Interfaces:
AutoCloseable
,org.apache.calcite.schema.Schema
,ExpandingConcurrentMap.MapValueFactory<WorkspaceSchemaFactory.TableInstance,
,DrillTable> SchemaPartitionExplorer
- Enclosing class:
- WorkspaceSchemaFactory
public class WorkspaceSchemaFactory.WorkspaceSchema
extends AbstractSchema
implements ExpandingConcurrentMap.MapValueFactory<WorkspaceSchemaFactory.TableInstance,DrillTable>
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.calcite.schema.Schema
org.apache.calcite.schema.Schema.TableType
-
Field Summary
Fields inherited from class org.apache.drill.exec.store.AbstractSchema
name, SCHEMA_SEPARATOR, schemaPath
-
Constructor Summary
ConstructorDescriptionWorkspaceSchema
(List<String> parentSchemaPath, String wsName, SchemaConfig schemaConfig, DrillFileSystem fs, WorkspaceConfig config) -
Method Summary
Modifier and TypeMethodDescriptionappendToStatsTable
(String tableName) Create an append statistics table entry for given tableName.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 filescreateStatsTable
(String tableName) Create stats table entry for given tableName.boolean
createView
(View view) Create a new view given definition.void
destroy
(DrillTable value) void
We check if the table contains homogeneous file formats that Drill can read.void
Drop the view with given name.getFS()
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 tableNameGet a list of sub-partitions of a particular table and the partitions specified by partition columns and values.org.apache.calcite.schema.Table
Used byInfoSchemaRecordGenerator.Tables
for getting all table objects along with type for every requested schema.Returns string describing schema type which shows where the schema came from.boolean
Methods inherited from class org.apache.drill.exec.store.AbstractSchema
applyFunctionParameters, areTableNamesCaseSensitive, close, createNewTable, getDefaultSchema, getExpression, getFullSchemaName, getFunctionParameters, getName, getSchemaPath, getSubSchema, getSubSchemaNames, getTablesByNames, getType, getTypeMap, getTypeNames, getUser, modifyTable, needToImpersonateReadingData, showInInformationSchema, snapshot, toString
-
Constructor Details
-
WorkspaceSchema
public WorkspaceSchema(List<String> parentSchemaPath, String wsName, SchemaConfig schemaConfig, DrillFileSystem fs, WorkspaceConfig config)
-
-
Method Details
-
createView
Description copied from class:AbstractSchema
Create a new view given definition.- Overrides:
createView
in classAbstractSchema
- Parameters:
view
- View info including name, definition etc.- Returns:
- Returns true if an existing view is replaced with the given view. False otherwise.
- Throws:
IOException
- in case of error creating a view
-
getSubPartitions
public Iterable<String> getSubPartitions(String table, List<String> partitionColumns, List<String> partitionValues) throws PartitionNotFoundException Description copied from interface:SchemaPartitionExplorer
Get a list of sub-partitions of a particular table and the partitions specified by partition columns and values. Individual storage plugins will assign specific meaning to the parameters and return values.For more info see docs in
PartitionExplorer
.- Specified by:
getSubPartitions
in interfaceSchemaPartitionExplorer
- Overrides:
getSubPartitions
in classAbstractSchema
partitionColumns
- a list of partitions to matchpartitionValues
- list of values of each partition (corresponding to the partition column list)- Returns:
- list of sub-partitions, will be empty if a there is no further level of sub-partitioning below, i.e. hit a leaf partition
- Throws:
PartitionNotFoundException
- when the partition does not exist in the given workspace
-
dropView
Description copied from class:AbstractSchema
Drop the view with given name.- Overrides:
dropView
in classAbstractSchema
- Parameters:
viewName
- view name- Throws:
IOException
- in case of error dropping the view
-
getTableNames
- Specified by:
getTableNames
in interfaceorg.apache.calcite.schema.Schema
- Overrides:
getTableNames
in classAbstractSchema
-
getFunctionNames
- Specified by:
getFunctionNames
in interfaceorg.apache.calcite.schema.Schema
- Overrides:
getFunctionNames
in classAbstractSchema
-
getFunctions
Description copied from class:AbstractSchema
For the given table names returns list of acceptable table functions which are common for all Drill schemas. When overriding this method, parent functions must be included first to be evaluated first. If not included, parent functions won't be taken into account when creating table instance.- Specified by:
getFunctions
in interfaceorg.apache.calcite.schema.Schema
- Overrides:
getFunctions
in classAbstractSchema
- Parameters:
name
- table name- Returns:
- list of table functions
-
getTable
- Specified by:
getTable
in interfaceorg.apache.calcite.schema.Schema
- Overrides:
getTable
in classAbstractSchema
-
isMutable
public boolean isMutable()- Specified by:
isMutable
in interfaceorg.apache.calcite.schema.Schema
- Overrides:
isMutable
in classAbstractSchema
-
getFS
-
getDefaultLocation
-
createNewTable
public CreateTableEntry createNewTable(String tableName, List<String> partitionColumns, StorageStrategy storageStrategy) Description copied from class:AbstractSchema
Creates table entry using table name, list of partition columns and storage strategy used to create table folder and files- Overrides:
createNewTable
in classAbstractSchema
- Parameters:
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 files- Returns:
- create table entry
-
createStatsTable
Description copied from class:AbstractSchema
Create stats table entry for given tableName.- Overrides:
createStatsTable
in classAbstractSchema
- Parameters:
tableName
- table name- Returns:
- instance of create table entry
-
appendToStatsTable
Description copied from class:AbstractSchema
Create an append statistics table entry for given tableName. If there is not existing statistics table, a new one is created.- Overrides:
appendToStatsTable
in classAbstractSchema
- Parameters:
tableName
- table name- Returns:
- instance of create table entry
-
getStatsTable
Description copied from class:AbstractSchema
Get the statistics table for given tableName- Overrides:
getStatsTable
in classAbstractSchema
- Parameters:
tableName
- table name- Returns:
- instance of statistics table
-
getTypeName
Description copied from class:AbstractSchema
Returns string describing schema type which shows where the schema came from. Good practice here is to return json type name of storage plugin's config.- Specified by:
getTypeName
in classAbstractSchema
- Returns:
- schema type name
-
create
- Specified by:
create
in interfaceExpandingConcurrentMap.MapValueFactory<WorkspaceSchemaFactory.TableInstance,
DrillTable>
-
destroy
- Specified by:
destroy
in interfaceExpandingConcurrentMap.MapValueFactory<WorkspaceSchemaFactory.TableInstance,
DrillTable>
-
dropTable
We check if the table contains homogeneous file formats that Drill can read. Once the checks are performed we rename the file to start with an "_". After the rename we issue a recursive delete of the directory.- Overrides:
dropTable
in classAbstractSchema
- Parameters:
table
- - Path of table to be dropped
-
getTableNamesAndTypes
Description copied from class:AbstractSchema
Used byInfoSchemaRecordGenerator.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.- Overrides:
getTableNamesAndTypes
in classAbstractSchema
- Returns:
- collection of table names and types
-