hudi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject [incubator-hudi] branch master updated: [HUDI-400] Check upgrade from old plan to new plan for compaction (#1422)
Date Fri, 20 Mar 2020 07:13:26 GMT
This is an automated email from the ASF dual-hosted git repository.

leesf pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hudi.git


The following commit(s) were added to refs/heads/master by this push:
     new 14e0c95  [HUDI-400] Check upgrade from old plan to new plan for compaction (#1422)
14e0c95 is described below

commit 14e0c95206f6d7c1806555490bcbce8785ffea5a
Author: Zhiyuan Zhao <49054376+zhaomin1423@users.noreply.github.com>
AuthorDate: Fri Mar 20 15:13:17 2020 +0800

    [HUDI-400] Check upgrade from old plan to new plan for compaction (#1422)
    
    * Fix NPE when DataFile is null
    * Check from old plan upgrade to new plan
---
 .../hudi/common/versioning/compaction/CompactionV2MigrationHandler.java | 2 +-
 .../src/test/java/org/apache/hudi/common/util/TestCompactionUtils.java  | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/hudi-common/src/main/java/org/apache/hudi/common/versioning/compaction/CompactionV2MigrationHandler.java
b/hudi-common/src/main/java/org/apache/hudi/common/versioning/compaction/CompactionV2MigrationHandler.java
index 26180e4..0c07b7c 100644
--- a/hudi-common/src/main/java/org/apache/hudi/common/versioning/compaction/CompactionV2MigrationHandler.java
+++ b/hudi-common/src/main/java/org/apache/hudi/common/versioning/compaction/CompactionV2MigrationHandler.java
@@ -55,7 +55,7 @@ public class CompactionV2MigrationHandler extends AbstractMigratorBase<HoodieCom
       v2CompactionOperationList = input.getOperations().stream().map(inp ->
         HoodieCompactionOperation.newBuilder().setBaseInstantTime(inp.getBaseInstantTime())
             .setFileId(inp.getFileId()).setPartitionPath(inp.getPartitionPath()).setMetrics(inp.getMetrics())
-            .setDataFilePath(new Path(inp.getDataFilePath()).getName()).setDeltaFilePaths(
+            .setDataFilePath(inp.getDataFilePath() == null ? null : new Path(inp.getDataFilePath()).getName()).setDeltaFilePaths(
                 inp.getDeltaFilePaths().stream().map(s -> new Path(s).getName()).collect(Collectors.toList()))
         .build()).collect(Collectors.toList());
     }
diff --git a/hudi-common/src/test/java/org/apache/hudi/common/util/TestCompactionUtils.java
b/hudi-common/src/test/java/org/apache/hudi/common/util/TestCompactionUtils.java
index 2d3cf2e..034ac3c 100644
--- a/hudi-common/src/test/java/org/apache/hudi/common/util/TestCompactionUtils.java
+++ b/hudi-common/src/test/java/org/apache/hudi/common/util/TestCompactionUtils.java
@@ -84,6 +84,8 @@ public class TestCompactionUtils extends HoodieCommonTestHarness {
     HoodieCompactionPlan newPlan = migrator.upgradeToLatest(plan, plan.getVersion());
     Assert.assertEquals(LATEST_COMPACTION_METADATA_VERSION, newPlan.getVersion());
     testFileSlicesCompactionPlanEquality(inputAndPlan.getKey(), newPlan);
+    HoodieCompactionPlan latestPlan = migrator.migrateToVersion(oldPlan, oldPlan.getVersion(),
newPlan.getVersion());
+    testFileSlicesCompactionPlanEquality(inputAndPlan.getKey(), latestPlan);
   }
 
   @Test


Mime
View raw message