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
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Automatically compute partition depth from files.protected final Map<String,
FileMetadataColumnDefn> protected final List<FileMetadataColumnDefn>
protected final String
-
Constructor Summary
ConstructorDescriptionImplicitColumnManager
(OptionSet optionManager, ImplicitColumnManager.ImplicitColumnOptions config) Constructor forImplicitColumnManager
for managing the insertion of file metadata (AKA "implicit" and partition) columns.ImplicitColumnManager
(OptionSet optionManager, ImplicitColumnManager.ImplicitColumnOptions config, org.apache.hadoop.fs.FileSystem fs) Constructor forImplicitColumnManager
for managing the insertion of file metadata (AKA "implicit" and partition) columns. -
Method Summary
Modifier and TypeMethodDescriptionvoid
bind
(ResultVectorCache vectorCache) void
close()
Event indicating the end of a scan.void
define()
Define (materialize) the columns which this manager represents.void
endFile()
Event indicating the end of a file (or other data source.)fileMetadata
(org.apache.hadoop.fs.Path filePath) boolean
void
load
(int rowCount) Load data into the custom columns, if needed (such as for null or implicit columns.)options()
int
partitionName
(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.boolean
resolveColumn
(ColumnProjection col, ResolvedTuple tuple, TupleMetadata tableSchema) Resolves metadata columns to concrete, materialized columns with the proper value for the present file.resolver()
void
startFile
(org.apache.hadoop.fs.Path filePath) void
vector
(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 forImplicitColumnManager
for 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 forImplicitColumnManager
for 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:
bind
in 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:
projectionParser
in interfaceMetadataManager
- See Also:
-
fileMetadata
-
hasImplicitCols
public boolean hasImplicitCols() -
partitionName
-
fileMetadataColDefns
-
startFile
public void startFile(org.apache.hadoop.fs.Path filePath) -
resolver
- Specified by:
resolver
in interfaceMetadataManager
-
define
public void define()Description copied from interface:MetadataManager
Define (materialize) the columns which this manager represents.- Specified by:
define
in interfaceMetadataManager
-
load
public void load(int rowCount) Description copied from interface:MetadataManager
Load data into the custom columns, if needed (such as for null or implicit columns.)- Specified by:
load
in interfaceMetadataManager
- Parameters:
rowCount
- number of rows read into a batch.
-
close
public void close()Description copied from interface:MetadataManager
Event indicating the end of a scan.- Specified by:
close
in interfaceMetadataManager
-
startResolution
public void startResolution()- Specified by:
startResolution
in interfaceReaderLevelProjection.ReaderProjectionResolver
-
endFile
public void endFile()Description copied from interface:MetadataManager
Event indicating the end of a file (or other data source.)- Specified by:
endFile
in interfaceMetadataManager
-
resolveColumn
Resolves metadata columns to concrete, materialized columns with the proper value for the present file.- Specified by:
resolveColumn
in interfaceReaderLevelProjection.ReaderProjectionResolver
-
vector
- Specified by:
vector
in interfaceVectorSource
-
partitionCount
public int partitionCount() -
metadataColumns
-