Package org.apache.drill.exec.store.dfs
Class FileSystemPlugin
java.lang.Object
org.apache.drill.exec.store.AbstractStoragePlugin
org.apache.drill.exec.store.dfs.FileSystemPlugin
- All Implemented Interfaces:
AutoCloseable
,SchemaFactory
,StoragePlugin
A Storage engine associated with a Hadoop FileSystem Implementation. Examples
include HDFS, MapRFS, QuantacastFileSystem, LocalFileSystem, as well Apache
Drill specific CachedFileSystem, ClassPathFileSystem and
LocalSyncableFileSystem. Tables are file names, directories and path
patterns. This storage engine delegates to FSFormatEngines but shares
references to the FileSystem configuration and path management.
-
Field Summary
Fields inherited from class org.apache.drill.exec.store.AbstractStoragePlugin
context
Fields inherited from interface org.apache.drill.exec.store.SchemaFactory
DEFAULT_WS_NAME
-
Constructor Summary
ConstructorDescriptionFileSystemPlugin
(FileSystemConfig config, DrillbitContext context, String name) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Method returns a Jackson serializable object that extends a StoragePluginConfig.getFormatPlugin
(String name) getFormatPlugin
(FormatPluginConfig config) If format plugin configuration is for named format plugin, will return format plugin from pre-loaded list by name.org.apache.hadoop.conf.Configuration
Set<? extends org.apache.calcite.plan.RelOptRule>
getOptimizerRules
(OptimizerRulesContext optimizerContext, PlannerPhase phase) An implementation of this method will return one or more specialized rules that Drill query optimizer can leverage in physical space.getPhysicalScan
(String userName, JSONOptions selection, List<SchemaPath> columns) Get the physical scan operator for the particular GroupScan (read) node.getPhysicalScan
(String userName, JSONOptions selection, List<SchemaPath> columns, SessionOptionManager options, MetadataProviderManager metadataProviderManager) Get the physical scan operator for the particular GroupScan (read) node.getPhysicalScan
(String userName, JSONOptions selection, SessionOptionManager options) Get the physical scan operator for the particular GroupScan (read) node.getPhysicalScan
(String userName, JSONOptions selection, SessionOptionManager options, MetadataProviderManager metadataProviderManager) Get the physical scan operator for the particular GroupScan (read) node.getTokenRegistry
(String username) This method returns theTokenRegistry
for a given user.void
initializeOauthTokenTable
(String username) void
This function is only used for testing and creates the necessary token tables.protected FormatCreator
newFormatCreator
(FileSystemConfig config, DrillbitContext context, org.apache.hadoop.conf.Configuration fsConf) Creates a new FormatCreator instance.void
Lifecycle method allowing the plugin to perform operations when it has been disabled.void
Lifecycle method allowing the plugin to perform operations when it has been enabled.void
registerSchemas
(SchemaConfig schemaConfig, org.apache.calcite.schema.SchemaPlus parent) Register the schemas provided by this SchemaFactory implementation under the given parent schema.void
start()
Initialize the storage plugin.boolean
Indicates if Drill can read the table from this format.Methods inherited from class org.apache.drill.exec.store.AbstractStoragePlugin
getContext, getName, getPhysicalScan, getPhysicalScan, supportsInsert, supportsWrite, toString
-
Constructor Details
-
FileSystemPlugin
public FileSystemPlugin(FileSystemConfig config, DrillbitContext context, String name) throws ExecutionSetupException - Throws:
ExecutionSetupException
-
-
Method Details
-
initializeOauthTokenTable
-
getTokenRegistry
-
getTokenRegistry
This method returns theTokenRegistry
for a given user. It is only used for testing user translation with OAuth 2.0.- Parameters:
username
- AString
of the current active user.- Returns:
- A
TokenRegistry
for the given user.
-
getTokenTable
-
newFormatCreator
protected FormatCreator newFormatCreator(FileSystemConfig config, DrillbitContext context, org.apache.hadoop.conf.Configuration fsConf) Creates a new FormatCreator instance. To be used by subclasses to return custom formats if required. Note that this method is called by the constructor, which fields may not be initialized yet.- Parameters:
config
- the plugin configurationcontext
- the drillbit context- Returns:
- a new FormatCreator instance
-
supportsRead
public boolean supportsRead()Description copied from interface:StoragePlugin
Indicates if Drill can read the table from this format.- Specified by:
supportsRead
in interfaceStoragePlugin
- Overrides:
supportsRead
in classAbstractStoragePlugin
-
getConfig
Description copied from interface:StoragePlugin
Method returns a Jackson serializable object that extends a StoragePluginConfig.- Returns:
- an extension of StoragePluginConfig
-
getPhysicalScan
public AbstractGroupScan getPhysicalScan(String userName, JSONOptions selection, SessionOptionManager options) throws IOException Description copied from interface:StoragePlugin
Get the physical scan operator for the particular GroupScan (read) node.- Specified by:
getPhysicalScan
in interfaceStoragePlugin
- Overrides:
getPhysicalScan
in classAbstractStoragePlugin
- Parameters:
userName
- User whom to impersonate when reading the contents as part of Scan.selection
- The configured storage engine specific selection.options
- (optional) session options- Returns:
- The physical scan operator for the particular GroupScan (read) node.
- Throws:
IOException
-
getPhysicalScan
public AbstractGroupScan getPhysicalScan(String userName, JSONOptions selection, SessionOptionManager options, MetadataProviderManager metadataProviderManager) throws IOException Description copied from interface:StoragePlugin
Get the physical scan operator for the particular GroupScan (read) node.- Specified by:
getPhysicalScan
in interfaceStoragePlugin
- Overrides:
getPhysicalScan
in classAbstractStoragePlugin
- Parameters:
userName
- User whom to impersonate when reading the contents as part of Scan.selection
- The configured storage engine specific selection.options
- (optional) session optionsmetadataProviderManager
- manager for handling metadata providers- Returns:
- The physical scan operator for the particular GroupScan (read) node.
- Throws:
IOException
-
getPhysicalScan
public AbstractGroupScan getPhysicalScan(String userName, JSONOptions selection, List<SchemaPath> columns) throws IOException Description copied from interface:StoragePlugin
Get the physical scan operator for the particular GroupScan (read) node.- Specified by:
getPhysicalScan
in interfaceStoragePlugin
- Overrides:
getPhysicalScan
in classAbstractStoragePlugin
- Parameters:
userName
- User whom to impersonate when reading the contents as part of Scan.selection
- The configured storage engine specific selection.columns
- (optional) The list of column names to scan from the data source.- Returns:
- The physical scan operator for the particular GroupScan (read) node.
- Throws:
IOException
-
getPhysicalScan
public AbstractGroupScan getPhysicalScan(String userName, JSONOptions selection, List<SchemaPath> columns, SessionOptionManager options, MetadataProviderManager metadataProviderManager) throws IOException Description copied from interface:StoragePlugin
Get the physical scan operator for the particular GroupScan (read) node.- Specified by:
getPhysicalScan
in interfaceStoragePlugin
- Overrides:
getPhysicalScan
in classAbstractStoragePlugin
- Parameters:
userName
- User whom to impersonate when reading the contents as part of Scan.selection
- The configured storage engine specific selection.columns
- (optional) The list of column names to scan from the data source.options
- (optional) session optionsmetadataProviderManager
- manager for handling metadata providers- Returns:
- The physical scan operator for the particular GroupScan (read) node.
- Throws:
IOException
-
registerSchemas
public void registerSchemas(SchemaConfig schemaConfig, org.apache.calcite.schema.SchemaPlus parent) throws IOException Description copied from interface:SchemaFactory
Register the schemas provided by this SchemaFactory implementation under the given parent schema.- Parameters:
schemaConfig
- Configuration for schema objects.parent
- Reference to parent schema.- Throws:
IOException
- in case of error during schema registration
-
getFormatPlugin
-
getFormatPlugin
If format plugin configuration is for named format plugin, will return format plugin from pre-loaded list by name. For other cases will try to find format plugin by its configuration, if not present will attempt to create one.- Specified by:
getFormatPlugin
in interfaceStoragePlugin
- Overrides:
getFormatPlugin
in classAbstractStoragePlugin
- Parameters:
config
- format plugin configuration- Returns:
- format plugin for given configuration if found, null otherwise
-
getOptimizerRules
public Set<? extends org.apache.calcite.plan.RelOptRule> getOptimizerRules(OptimizerRulesContext optimizerContext, PlannerPhase phase) Description copied from interface:StoragePlugin
An implementation of this method will return one or more specialized rules that Drill query optimizer can leverage in physical space. Otherwise, it should return an empty set.- Returns:
- an empty set or a set of plugin specific physical optimizer rules.
-
getFsConf
public org.apache.hadoop.conf.Configuration getFsConf() -
initializeTokenTableForTesting
public void initializeTokenTableForTesting()This function is only used for testing and creates the necessary token tables. Note that the token tables still need to be populated. -
start
public void start()Description copied from interface:StoragePlugin
Initialize the storage plugin. The storage plugin will not be used until this method is called.- Specified by:
start
in interfaceStoragePlugin
- Overrides:
start
in classAbstractStoragePlugin
-
onEnabled
public void onEnabled()Description copied from interface:StoragePlugin
Lifecycle method allowing the plugin to perform operations when it has been enabled.- Specified by:
onEnabled
in interfaceStoragePlugin
- Overrides:
onEnabled
in classAbstractStoragePlugin
-
onDisabled
public void onDisabled()Description copied from interface:StoragePlugin
Lifecycle method allowing the plugin to perform operations when it has been disabled.- Specified by:
onDisabled
in interfaceStoragePlugin
- Overrides:
onDisabled
in classAbstractStoragePlugin
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Overrides:
close
in classAbstractStoragePlugin
-