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
contextFields inherited from interface org.apache.drill.exec.store.SchemaFactory
DEFAULT_WS_NAME -
Constructor Summary
ConstructorsConstructorDescriptionFileSystemPlugin(FileSystemConfig config, DrillbitContext context, String name) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()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.ConfigurationSet<? 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 theTokenRegistryfor a given user.voidinitializeOauthTokenTable(String username) voidThis function is only used for testing and creates the necessary token tables.protected FormatCreatornewFormatCreator(FileSystemConfig config, DrillbitContext context, org.apache.hadoop.conf.Configuration fsConf) Creates a new FormatCreator instance.voidLifecycle method allowing the plugin to perform operations when it has been disabled.voidLifecycle method allowing the plugin to perform operations when it has been enabled.voidregisterSchemas(SchemaConfig schemaConfig, org.apache.calcite.schema.SchemaPlus parent) Register the schemas provided by this SchemaFactory implementation under the given parent schema.voidstart()Initialize the storage plugin.booleanIndicates 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 theTokenRegistryfor a given user. It is only used for testing user translation with OAuth 2.0.- Parameters:
username- AStringof the current active user.- Returns:
- A
TokenRegistryfor 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:StoragePluginIndicates if Drill can read the table from this format.- Specified by:
supportsReadin interfaceStoragePlugin- Overrides:
supportsReadin classAbstractStoragePlugin
-
getConfig
Description copied from interface:StoragePluginMethod 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:StoragePluginGet the physical scan operator for the particular GroupScan (read) node.- Specified by:
getPhysicalScanin interfaceStoragePlugin- Overrides:
getPhysicalScanin 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:StoragePluginGet the physical scan operator for the particular GroupScan (read) node.- Specified by:
getPhysicalScanin interfaceStoragePlugin- Overrides:
getPhysicalScanin 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:StoragePluginGet the physical scan operator for the particular GroupScan (read) node.- Specified by:
getPhysicalScanin interfaceStoragePlugin- Overrides:
getPhysicalScanin 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:StoragePluginGet the physical scan operator for the particular GroupScan (read) node.- Specified by:
getPhysicalScanin interfaceStoragePlugin- Overrides:
getPhysicalScanin 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:SchemaFactoryRegister 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:
getFormatPluginin interfaceStoragePlugin- Overrides:
getFormatPluginin 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:StoragePluginAn 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:StoragePluginInitialize the storage plugin. The storage plugin will not be used until this method is called.- Specified by:
startin interfaceStoragePlugin- Overrides:
startin classAbstractStoragePlugin
-
onEnabled
public void onEnabled()Description copied from interface:StoragePluginLifecycle method allowing the plugin to perform operations when it has been enabled.- Specified by:
onEnabledin interfaceStoragePlugin- Overrides:
onEnabledin classAbstractStoragePlugin
-
onDisabled
public void onDisabled()Description copied from interface:StoragePluginLifecycle method allowing the plugin to perform operations when it has been disabled.- Specified by:
onDisabledin interfaceStoragePlugin- Overrides:
onDisabledin classAbstractStoragePlugin
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classAbstractStoragePlugin
-