Package org.apache.drill.exec.store.dfs
Class FileSelection
java.lang.Object
org.apache.drill.exec.store.dfs.FileSelection
- All Implemented Interfaces:
DrillTableSelection
- Direct Known Subclasses:
IcebergMetadataFileSelection
Jackson serializable description of a file selection.
-
Field Summary
Modifier and TypeFieldDescriptionfinal org.apache.hadoop.fs.Path
root path for the metadata cache file (if any)List<org.apache.hadoop.fs.Path>
final org.apache.hadoop.fs.Path
root path for the selections -
Constructor Summary
ModifierConstructorDescriptionFileSelection
(List<org.apache.hadoop.fs.FileStatus> statuses, List<org.apache.hadoop.fs.Path> files, org.apache.hadoop.fs.Path selectionRoot) Creates aselection
out of given file statuses/files and selection root.FileSelection
(List<org.apache.hadoop.fs.FileStatus> statuses, List<org.apache.hadoop.fs.Path> files, org.apache.hadoop.fs.Path selectionRoot, org.apache.hadoop.fs.Path cacheFileRoot, boolean wasAllPartitionsPruned) FileSelection
(List<org.apache.hadoop.fs.FileStatus> statuses, List<org.apache.hadoop.fs.Path> files, org.apache.hadoop.fs.Path selectionRoot, org.apache.hadoop.fs.Path cacheFileRoot, boolean wasAllPartitionsPruned, org.apache.drill.exec.store.dfs.FileSelection.StatusType dirStatus) protected
FileSelection
(FileSelection selection) Copy constructor for convenience. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkBackPaths
(String parent, String combinedPath, String subpath) Check if the path is a valid sub path under the parent after removing backpaths.boolean
static FileSelection
create
(List<org.apache.hadoop.fs.FileStatus> statuses, List<org.apache.hadoop.fs.Path> files, org.apache.hadoop.fs.Path root) static FileSelection
create
(List<org.apache.hadoop.fs.FileStatus> statuses, List<org.apache.hadoop.fs.Path> files, org.apache.hadoop.fs.Path root, org.apache.hadoop.fs.Path cacheFileRoot, boolean wasAllPartitionsPruned) Creates aselection
with the given file statuses/files and selection root.static FileSelection
create
(DrillFileSystem fs, String parent, String path, boolean allowAccessOutsideWorkspace) static FileSelection
createFromDirectories
(List<org.apache.hadoop.fs.Path> dirPaths, FileSelection selection, org.apache.hadoop.fs.Path cacheFileRoot) digest()
The digest of the selection represented by the implementation.org.apache.hadoop.fs.Path
org.apache.drill.exec.store.dfs.FileSelection.StatusType
List<org.apache.hadoop.fs.Path>
getFiles()
List<org.apache.hadoop.fs.FileStatus>
org.apache.hadoop.fs.FileStatus
org.apache.hadoop.fs.Path
List<org.apache.hadoop.fs.FileStatus>
boolean
boolean
boolean
boolean
void
SettingemptyDirectory
as true allows to identify thisselectionRoot
as an empty directoryvoid
void
void
setHadWildcard
(boolean wc) void
setMetaContext
(MetadataContext context) boolean
toString()
boolean
-
Field Details
-
files
-
selectionRoot
public final org.apache.hadoop.fs.Path selectionRootroot path for the selections -
cacheFileRoot
public final org.apache.hadoop.fs.Path cacheFileRootroot path for the metadata cache file (if any)
-
-
Constructor Details
-
FileSelection
public FileSelection(List<org.apache.hadoop.fs.FileStatus> statuses, List<org.apache.hadoop.fs.Path> files, org.apache.hadoop.fs.Path selectionRoot) Creates aselection
out of given file statuses/files and selection root.- Parameters:
statuses
- list of file statusesfiles
- list of filesselectionRoot
- root path for selections
-
FileSelection
-
FileSelection
-
FileSelection
Copy constructor for convenience.
-
-
Method Details
-
getSelectionRoot
public org.apache.hadoop.fs.Path getSelectionRoot() -
getStatuses
- Throws:
IOException
-
getFiles
-
containsDirectories
- Throws:
IOException
-
minusDirectories
- Throws:
IOException
-
selectAnyFile
- Throws:
IOException
-
getFirstPath
- Throws:
IOException
-
setExpandedFully
public void setExpandedFully() -
isExpandedFully
public boolean isExpandedFully() -
setExpandedPartial
public void setExpandedPartial() -
isExpandedPartial
public boolean isExpandedPartial() -
getDirStatus
public org.apache.drill.exec.store.dfs.FileSelection.StatusType getDirStatus() -
wasAllPartitionsPruned
public boolean wasAllPartitionsPruned() -
create
public static FileSelection create(DrillFileSystem fs, String parent, String path, boolean allowAccessOutsideWorkspace) throws IOException - Throws:
IOException
-
create
public static FileSelection create(List<org.apache.hadoop.fs.FileStatus> statuses, List<org.apache.hadoop.fs.Path> files, org.apache.hadoop.fs.Path root, org.apache.hadoop.fs.Path cacheFileRoot, boolean wasAllPartitionsPruned) Creates aselection
with the given file statuses/files and selection root.- Parameters:
statuses
- list of file statusesfiles
- list of filesroot
- root path for selectionscacheFileRoot
- root path for metadata cache (null for no metadata cache)- Returns:
- null if creation of
FileSelection
fails with anIllegalArgumentException
otherwise a new selection. - See Also:
-
create
public static FileSelection create(List<org.apache.hadoop.fs.FileStatus> statuses, List<org.apache.hadoop.fs.Path> files, org.apache.hadoop.fs.Path root) -
createFromDirectories
public static FileSelection createFromDirectories(List<org.apache.hadoop.fs.Path> dirPaths, FileSelection selection, org.apache.hadoop.fs.Path cacheFileRoot) -
checkBackPaths
Check if the path is a valid sub path under the parent after removing backpaths. Throw an exception if it is not. We pass subpath in as a parameter only for the error message- Parameters:
parent
- The parent path (the workspace directory).combinedPath
- The workspace directory and (relative) subpath path combined.subpath
- For error message only, the subpath
-
getFileStatuses
-
supportsDirPruning
public boolean supportsDirPruning() -
setHadWildcard
public void setHadWildcard(boolean wc) -
hadWildcard
public boolean hadWildcard() -
getCacheFileRoot
public org.apache.hadoop.fs.Path getCacheFileRoot() -
setMetaContext
-
getMetaContext
-
isEmptyDirectory
public boolean isEmptyDirectory()- Returns:
- true if this
selectionRoot
points to an empty directory, false otherwise
-
setEmptyDirectoryStatus
public void setEmptyDirectoryStatus()SettingemptyDirectory
as true allows to identify thisselectionRoot
as an empty directory -
digest
Description copied from interface:DrillTableSelection
The digest of the selection represented by the implementation. The selections that accompany Tables can modify the contained dataset, e.g. a file selection can restrict to a subset of the available data and a format selection can include options that affect the behaviour of the underlying reader. Two scans will end up being considered identical during logical planning if their digests are the same so selection implementations should override this method so that exactly those scans that really are identical (in terms of the data they produce) have matching digests.- Specified by:
digest
in interfaceDrillTableSelection
- Returns:
- this selection's digest, normally a string built from its properties.
-
toString
-