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
FieldsModifier and TypeFieldDescriptionfinal org.apache.hadoop.fs.Pathroot path for the metadata cache file (if any)List<org.apache.hadoop.fs.Path> final org.apache.hadoop.fs.Pathroot path for the selections -
Constructor Summary
ConstructorsModifierConstructorDescriptionFileSelection(List<org.apache.hadoop.fs.FileStatus> statuses, List<org.apache.hadoop.fs.Path> files, org.apache.hadoop.fs.Path selectionRoot) Creates aselectionout 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) protectedFileSelection(FileSelection selection) Copy constructor for convenience. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckBackPaths(String parent, String combinedPath, String subpath) Check if the path is a valid sub path under the parent after removing backpaths.booleanstatic FileSelectioncreate(List<org.apache.hadoop.fs.FileStatus> statuses, List<org.apache.hadoop.fs.Path> files, org.apache.hadoop.fs.Path root) static FileSelectioncreate(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 aselectionwith the given file statuses/files and selection root.static FileSelectioncreate(DrillFileSystem fs, String parent, String path, boolean allowAccessOutsideWorkspace) static FileSelectioncreateFromDirectories(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.Pathorg.apache.drill.exec.store.dfs.FileSelection.StatusTypeList<org.apache.hadoop.fs.Path> getFiles()List<org.apache.hadoop.fs.FileStatus> org.apache.hadoop.fs.FileStatusorg.apache.hadoop.fs.PathList<org.apache.hadoop.fs.FileStatus> booleanbooleanbooleanbooleanvoidSettingemptyDirectoryas true allows to identify thisselectionRootas an empty directoryvoidvoidvoidsetHadWildcard(boolean wc) voidsetMetaContext(MetadataContext context) booleantoString()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 aselectionout 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 aselectionwith 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
FileSelectionfails with anIllegalArgumentExceptionotherwise 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
selectionRootpoints to an empty directory, false otherwise
-
setEmptyDirectoryStatus
public void setEmptyDirectoryStatus()SettingemptyDirectoryas true allows to identify thisselectionRootas an empty directory -
digest
Description copied from interface:DrillTableSelectionThe 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:
digestin interfaceDrillTableSelection- Returns:
- this selection's digest, normally a string built from its properties.
-
toString
-