This is an automated email from the ASF dual-hosted git repository.

aokolnychyi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/master by this push:
     new 2ecbeb4  Core: Fix replaced partitions validation in SnapshotManager 
(#1677)
2ecbeb4 is described below

commit 2ecbeb4a42dc594f09be96a29ba574ef2796f935
Author: Ryan Blue <[email protected]>
AuthorDate: Thu Oct 29 11:25:32 2020 -0700

    Core: Fix replaced partitions validation in SnapshotManager (#1677)
---
 core/src/main/java/org/apache/iceberg/SnapshotManager.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/iceberg/SnapshotManager.java 
b/core/src/main/java/org/apache/iceberg/SnapshotManager.java
index efc8cef..93ae46f 100644
--- a/core/src/main/java/org/apache/iceberg/SnapshotManager.java
+++ b/core/src/main/java/org/apache/iceberg/SnapshotManager.java
@@ -255,7 +255,7 @@ public class SnapshotManager extends 
MergingSnapshotProducer<ManageSnapshots> im
 
   private static void validateReplacedPartitions(TableMetadata meta, Long 
parentId,
                                                  PartitionSet 
replacedPartitions) {
-    if (replacedPartitions != null) {
+    if (replacedPartitions != null && meta.currentSnapshot() != null) {
       ValidationException.check(parentId == null || isCurrentAncestor(meta, 
parentId),
           "Cannot cherry-pick overwrite, based on non-ancestor of the current 
state: %s", parentId);
       List<DataFile> newFiles = SnapshotUtil.newFiles(parentId, 
meta.currentSnapshot().snapshotId(), meta::snapshot);

Reply via email to