You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/07/26 22:34:21 UTC

[GitHub] [iceberg] rdblue commented on a change in pull request #2852: Core: Fix the NPE in DataFiles.Builder#copy

rdblue commented on a change in pull request #2852:
URL: https://github.com/apache/iceberg/pull/2852#discussion_r676988303



##########
File path: core/src/main/java/org/apache/iceberg/DataFiles.java
##########
@@ -176,7 +176,7 @@ public Builder copy(DataFile toCopy) {
       this.keyMetadata = toCopy.keyMetadata() == null ? null
           : ByteBuffers.copy(toCopy.keyMetadata());
       this.splitOffsets = toCopy.splitOffsets() == null ? null : copyList(toCopy.splitOffsets());
-      this.sortOrderId = toCopy.sortOrderId();
+      this.sortOrderId = toCopy.sortOrderId() == null ? SortOrder.unsorted().orderId() : toCopy.sortOrderId();

Review comment:
       If the copied `DataFile` returns null, shouldn't the copy also return null? Why not make the builder use `Integer` instead of a primitive here?




-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org