Package org.apache.druid.frame.util
Class DurableStorageUtils
java.lang.Object
org.apache.druid.frame.util.DurableStorageUtils
Helper class that fetches the directory and file names corresponding to file location
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetControllerDirectory(String controllerTaskId) static StringTries to parse out the most top level directory from the path.static StringgetOutputsFileNameForPath(String controllerTaskId, int stageNumber, int workerNumber, String taskId, String path) Fetches the file location where a particular worker writes the data corresponding to a particular stage and a custom path namestatic StringgetPartitionOutputsFileNameWithPathForPartition(String controllerTaskId, int stageNumber, int workerNumber, String taskId, int partitionNumber) Fetches the file location where a particular worker writes the data corresponding to a particular stage and partitionstatic StringgetQueryResultsFileNameWithPathForPartition(String controllerTaskId, int stageNumber, int workerNumber, String taskId, int partitionNumber) static StringgetQueryResultsForTaskIdFolderName(String controllerTaskId, int stageNumber, int workerNumber, String taskId) static StringgetQueryResultsSuccessFilePath(String controllerTaskId, int stageNumber, int workerNumber) static StringgetTaskIdOutputsFolderName(String controllerTaskId, int stageNumber, int workerNumber, String taskId) Fetches the directory location where a particular worker will store the partition files corresponding to the stage number, and it's task idstatic StringgetWorkerOutputSuccessFilePath(String controllerTaskId, int stageNumber, int workerNumber) static booleanisQueryResultFileActive(String path, Set<String> knownTasks) Tries to parse out the controller taskID from the query results path, and checks if the taskID is present in the set of known tasks.
-
Field Details
-
SUCCESS_MARKER_FILENAME
- See Also:
-
SPLITTER
public static final com.google.common.base.Splitter SPLITTER -
QUERY_RESULTS_DIR
- See Also:
-
-
Constructor Details
-
DurableStorageUtils
public DurableStorageUtils()
-
-
Method Details
-
getControllerDirectory
-
getWorkerOutputSuccessFilePath
-
getQueryResultsSuccessFilePath
-
getTaskIdOutputsFolderName
public static String getTaskIdOutputsFolderName(String controllerTaskId, int stageNumber, int workerNumber, String taskId) Fetches the directory location where a particular worker will store the partition files corresponding to the stage number, and it's task id -
getQueryResultsForTaskIdFolderName
-
getPartitionOutputsFileNameWithPathForPartition
public static String getPartitionOutputsFileNameWithPathForPartition(String controllerTaskId, int stageNumber, int workerNumber, String taskId, int partitionNumber) Fetches the file location where a particular worker writes the data corresponding to a particular stage and partition -
getQueryResultsFileNameWithPathForPartition
-
getOutputsFileNameForPath
public static String getOutputsFileNameForPath(String controllerTaskId, int stageNumber, int workerNumber, String taskId, String path) Fetches the file location where a particular worker writes the data corresponding to a particular stage and a custom path name -
getNextDirNameWithPrefixFromPath
Tries to parse out the most top level directory from the path. Returns null if there is no such directory.
For eg:
- for input path controller_query_id/task/123 the function will return controller_query_id
- for input path abcd, the function will return abcd
- for input path null, the function will return null
-
isQueryResultFileActive
Tries to parse out the controller taskID from the query results path, and checks if the taskID is present in the set of known tasks. Returns true if the set contains the taskId. Returns false if taskId could not be parsed or if the set does not contain the taskId.
For eg:
- for path controller_query_id/task/123 the function will return false
- for path query-result/controller_query_id/results.json, the function will return true if the controller_query_id is in known tasks
- for path query-result/controller_query_id/results.json, the function will return false if the controller_query_id is not in known tasks
- for path null, the function will return false
-