You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by GitBox <gi...@apache.org> on 2019/01/14 18:56:00 UTC

[incubator-iceberg] Diff for: [GitHub] rdblue merged pull request #71: Allow passing the unpartitioned spec to DataFiles.builder.

diff --git a/core/src/main/java/com/netflix/iceberg/DataFiles.java b/core/src/main/java/com/netflix/iceberg/DataFiles.java
index bee52521..b3bac118 100644
--- a/core/src/main/java/com/netflix/iceberg/DataFiles.java
+++ b/core/src/main/java/com/netflix/iceberg/DataFiles.java
@@ -194,8 +194,8 @@ public Builder() {
 
     public Builder(PartitionSpec spec) {
       this.spec = spec;
-      this.partitionData = newPartitionData(spec);
-      this.isPartitioned = true;
+      this.isPartitioned = spec.fields().size() > 0;
+      this.partitionData = isPartitioned ? newPartitionData(spec) : null;
     }
 
     public void clear() {
@@ -284,7 +284,7 @@ public Builder withBlockSizeInBytes(long blockSizeInBytes) {
     }
 
     public Builder withPartitionPath(String partitionPath) {
-      Preconditions.checkArgument(isPartitioned,
+      Preconditions.checkArgument(isPartitioned || partitionPath.isEmpty(),
           "Cannot add partition data for an unpartitioned table");
       this.partitionData = fillFromPath(spec, partitionPath, partitionData);
       return this;


With regards,
Apache Git Services