From bd9cceccb582ede88b989824241498e8c32d4f13 Mon Sep 17 00:00:00 2001 From: Raymond Xu <2701446+xushiyan@users.noreply.github.com> Date: Wed, 9 Dec 2020 18:19:19 -0800 Subject: [PATCH] [HUDI-1395] Fix partition path using FSUtils (#2312) Fixed the logic to get partition path in Copier and Exporter utilities. --- .../java/org/apache/hudi/utilities/HoodieSnapshotCopier.java | 4 ++-- .../org/apache/hudi/utilities/HoodieSnapshotExporter.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hudi-utilities/src/main/java/org/apache/hudi/utilities/HoodieSnapshotCopier.java b/hudi-utilities/src/main/java/org/apache/hudi/utilities/HoodieSnapshotCopier.java index 05b462730..282610893 100644 --- a/hudi-utilities/src/main/java/org/apache/hudi/utilities/HoodieSnapshotCopier.java +++ b/hudi-utilities/src/main/java/org/apache/hudi/utilities/HoodieSnapshotCopier.java @@ -111,7 +111,7 @@ public class HoodieSnapshotCopier implements Serializable { // also need to copy over partition metadata Path partitionMetaFile = - new Path(new Path(baseDir, partition), HoodiePartitionMetadata.HOODIE_PARTITION_METAFILE); + new Path(FSUtils.getPartitionPath(baseDir, partition), HoodiePartitionMetadata.HOODIE_PARTITION_METAFILE); if (fs1.exists(partitionMetaFile)) { filePaths.add(new Tuple2<>(partition, partitionMetaFile.toString())); } @@ -122,7 +122,7 @@ public class HoodieSnapshotCopier implements Serializable { context.foreach(filesToCopy, tuple -> { String partition = tuple._1(); Path sourceFilePath = new Path(tuple._2()); - Path toPartitionPath = new Path(outputDir, partition); + Path toPartitionPath = FSUtils.getPartitionPath(outputDir, partition); FileSystem ifs = FSUtils.getFs(baseDir, serConf.newCopy()); if (!ifs.exists(toPartitionPath)) { diff --git a/hudi-utilities/src/main/java/org/apache/hudi/utilities/HoodieSnapshotExporter.java b/hudi-utilities/src/main/java/org/apache/hudi/utilities/HoodieSnapshotExporter.java index cf69dd220..c69d0044e 100644 --- a/hudi-utilities/src/main/java/org/apache/hudi/utilities/HoodieSnapshotExporter.java +++ b/hudi-utilities/src/main/java/org/apache/hudi/utilities/HoodieSnapshotExporter.java @@ -208,7 +208,7 @@ public class HoodieSnapshotExporter { dataFiles.forEach(hoodieDataFile -> filePaths.add(new Tuple2<>(partition, hoodieDataFile.getPath()))); // also need to copy over partition metadata Path partitionMetaFile = - new Path(new Path(cfg.sourceBasePath, partition), HoodiePartitionMetadata.HOODIE_PARTITION_METAFILE); + new Path(FSUtils.getPartitionPath(cfg.sourceBasePath, partition), HoodiePartitionMetadata.HOODIE_PARTITION_METAFILE); FileSystem fs = FSUtils.getFs(cfg.sourceBasePath, serConf.newCopy()); if (fs.exists(partitionMetaFile)) { filePaths.add(new Tuple2<>(partition, partitionMetaFile.toString())); @@ -219,7 +219,7 @@ public class HoodieSnapshotExporter { context.foreach(files, tuple -> { String partition = tuple._1(); Path sourceFilePath = new Path(tuple._2()); - Path toPartitionPath = new Path(cfg.targetOutputPath, partition); + Path toPartitionPath = FSUtils.getPartitionPath(cfg.targetOutputPath, partition); FileSystem fs = FSUtils.getFs(cfg.targetOutputPath, serConf.newCopy()); if (!fs.exists(toPartitionPath)) {