vinothchandar commented on a change in pull request #651: Spark Stage retry
handling
URL: https://github.com/apache/incubator-hudi/pull/651#discussion_r285289306
##########
File path: hoodie-common/src/main/java/com/uber/hoodie/common/util/FSUtils.java
##########
@@ -92,26 +100,46 @@ public static FileSystem getFs(String path, Configuration
conf) {
return fs;
}
- public static String makeDataFileName(String commitTime, int
taskPartitionId, String fileId) {
- return String.format("%s_%d_%s.parquet", fileId, taskPartitionId,
commitTime);
+ /**
+ * A write token uniquely identifies an attempt at one of the IOHandle
operations (Merge/Create/Append)
+ */
+ public static String makeWriteToken(int taskPartitionId, int stageId, long
taskAttemptId) {
+ return String.format("%d-%d-%d", taskPartitionId, stageId, taskAttemptId);
}
- public static String makeTempDataFileName(String partitionPath, String
commitTime,
- int taskPartitionId, String fileId, int stageId, long taskAttemptId) {
- return String.format("%s_%s_%d_%s_%d_%d.parquet",
partitionPath.replace("/", "-"), fileId,
- taskPartitionId, commitTime, stageId, taskAttemptId);
+
+ public static String makeDataFileName(String commitTime, String writeToken,
String fileId) {
+ return String.format("%s_%s_%s.parquet", fileId, writeToken, commitTime);
}
- public static String maskWithoutFileId(String commitTime, int
taskPartitionId) {
- return String.format("*_%s_%s.parquet", taskPartitionId, commitTime);
+ public static String makeTempDataFileName(String partitionPath, String
commitTime, String fileId, String writeToken) {
+ return String.format("%s_%s_%s_%s.parquet", partitionPath.replace("/",
"-"), fileId,
+ writeToken, commitTime);
}
- public static String maskWithoutTaskPartitionId(String commitTime, String
fileId) {
- return String.format("%s_*_%s.parquet", fileId, commitTime);
+ public static String makeMarkerFile(String commitTime, String writeToken,
String fileId) {
+ return String.format("%s_%s_%s%s", fileId, writeToken, commitTime,
MARKER_EXTN);
}
- public static String maskWithOnlyCommitTime(String commitTime) {
- return String.format("*_*_%s.parquet", commitTime);
+ public static String translateMarkerToDataPath(String basePath, String
markerPath, String instantTs) {
+ Preconditions.checkArgument(markerPath.endsWith(MARKER_EXTN));
+ String markerRootPath = Path.getPathWithoutSchemeAndAuthority(new Path(
+ String.format("%s/%s/%s", basePath,
HoodieTableMetaClient.TEMPFOLDER_NAME, instantTs))).toString();
+ int begin = markerPath.indexOf(markerRootPath);
+ Preconditions.checkArgument(begin >= 0, "Not in marker dir. Marker Path="
+ markerPath
+ + ", Expected Marker Root=" + markerRootPath);
+ String rPath = markerPath.substring(begin + markerRootPath.length() + 1);
+ return String.format("%s/%s.parquet", basePath, rPath.replace(MARKER_EXTN,
""));
Review comment:
same: remove harcoding of `.parquet`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services