Class ImplicitColumnManager
java.lang.Object
org.apache.drill.exec.physical.impl.scan.file.ImplicitColumnManager
- All Implemented Interfaces:
MetadataManager,ReaderLevelProjection.ReaderProjectionResolver,VectorSource
public class ImplicitColumnManager
extends Object
implements MetadataManager, ReaderLevelProjection.ReaderProjectionResolver, VectorSource
Manages the insertion of file metadata (AKA "implicit" and partition) columns.
Parses the file metadata columns from the projection list. Creates and loads
the vectors that hold the data. If running in legacy mode, inserts partition
columns when the query contains a wildcard. Supports renaming the columns via
session options.
The lifecycle is that the manager is given the set of files for this scan operator so it can determine the partition depth. (Note that different scans may not agree on the depth. This is a known issue with Drill's implementation.)
Then, at the start of the scan, all projection columns are parsed. This class picks out the file metadata columns.
On each file (on each reader), the columns are "resolved." Here, that means that the columns are filled in with actual values based on the present file.
This is the successor to ColumnExplorer.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intAutomatically compute partition depth from files.protected final Map<String, FileMetadataColumnDefn> protected final List<FileMetadataColumnDefn> protected final String -
Constructor Summary
ConstructorsConstructorDescriptionImplicitColumnManager(OptionSet optionManager, ImplicitColumnManager.ImplicitColumnOptions config) Constructor forImplicitColumnManagerfor managing the insertion of file metadata (AKA "implicit" and partition) columns.ImplicitColumnManager(OptionSet optionManager, ImplicitColumnManager.ImplicitColumnOptions config, org.apache.hadoop.fs.FileSystem fs) Constructor forImplicitColumnManagerfor managing the insertion of file metadata (AKA "implicit" and partition) columns. -
Method Summary
Modifier and TypeMethodDescriptionvoidbind(ResultVectorCache vectorCache) voidclose()Event indicating the end of a scan.voiddefine()Define (materialize) the columns which this manager represents.voidendFile()Event indicating the end of a file (or other data source.)fileMetadata(org.apache.hadoop.fs.Path filePath) booleanvoidload(int rowCount) Load data into the custom columns, if needed (such as for null or implicit columns.)options()intpartitionName(int partition) Returns the file metadata column parser that: Picks out the file metadata and partition columns, Inserts partition columns for a wildcard query, if the option to do so is set.booleanresolveColumn(ColumnProjection col, ResolvedTuple tuple, TupleMetadata tableSchema) Resolves metadata columns to concrete, materialized columns with the proper value for the present file.resolver()voidstartFile(org.apache.hadoop.fs.Path filePath) voidvector(int index)
-
Field Details
-
AUTO_PARTITION_DEPTH
public static final int AUTO_PARTITION_DEPTHAutomatically compute partition depth from files. Use only for testing!- See Also:
-
partitionDesignator
-
implicitColDefns
-
fileMetadataColIndex
-
-
Constructor Details
-
ImplicitColumnManager
public ImplicitColumnManager(OptionSet optionManager, ImplicitColumnManager.ImplicitColumnOptions config, org.apache.hadoop.fs.FileSystem fs) Constructor forImplicitColumnManagerfor managing the insertion of file metadata (AKA "implicit" and partition) columns.- Parameters:
optionManager- access to the options for this query; used too look up custom names for the metadata columnsconfig- implicit column optionsfs- file system
-
ImplicitColumnManager
public ImplicitColumnManager(OptionSet optionManager, ImplicitColumnManager.ImplicitColumnOptions config) Constructor forImplicitColumnManagerfor managing the insertion of file metadata (AKA "implicit" and partition) columns.- Parameters:
optionManager- access to the options for this query; used too look up custom names for the metadata columnsconfig- implicit column options
-
-
Method Details
-
options
-
bind
- Specified by:
bindin interfaceMetadataManager
-
projectionParser
Returns the file metadata column parser that:- Picks out the file metadata and partition columns,
- Inserts partition columns for a wildcard query, if the option to do so is set.
- Specified by:
projectionParserin interfaceMetadataManager- See Also:
-
fileMetadata
-
hasImplicitCols
public boolean hasImplicitCols() -
partitionName
-
fileMetadataColDefns
-
startFile
public void startFile(org.apache.hadoop.fs.Path filePath) -
resolver
- Specified by:
resolverin interfaceMetadataManager
-
define
public void define()Description copied from interface:MetadataManagerDefine (materialize) the columns which this manager represents.- Specified by:
definein interfaceMetadataManager
-
load
public void load(int rowCount) Description copied from interface:MetadataManagerLoad data into the custom columns, if needed (such as for null or implicit columns.)- Specified by:
loadin interfaceMetadataManager- Parameters:
rowCount- number of rows read into a batch.
-
close
public void close()Description copied from interface:MetadataManagerEvent indicating the end of a scan.- Specified by:
closein interfaceMetadataManager
-
startResolution
public void startResolution()- Specified by:
startResolutionin interfaceReaderLevelProjection.ReaderProjectionResolver
-
endFile
public void endFile()Description copied from interface:MetadataManagerEvent indicating the end of a file (or other data source.)- Specified by:
endFilein interfaceMetadataManager
-
resolveColumn
Resolves metadata columns to concrete, materialized columns with the proper value for the present file.- Specified by:
resolveColumnin interfaceReaderLevelProjection.ReaderProjectionResolver
-
vector
- Specified by:
vectorin interfaceVectorSource
-
partitionCount
public int partitionCount() -
metadataColumns
-