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/23 06:35:48 UTC

[GitHub] [iceberg] openinx opened a new pull request #2852: Core: Fix the NPE in DataFiles.Builder#copy

openinx opened a new pull request #2852:
URL: https://github.com/apache/iceberg/pull/2852


   There's a minor bug that was introduced from this [PR](https://github.com/apache/iceberg/pull/1975/files#diff-ac5b4d1edab36f13fd929683cad0f56951ac019353354ac886e84d099d5dd219R179). 
   
   The DataFiles which were deserialized from manifests have a null sortOrderId, that means it will encounter an Exception when we convert the `null` Integer to a primitive int.


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


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

Posted by GitBox <gi...@apache.org>.
openinx commented on a change in pull request #2852:
URL: https://github.com/apache/iceberg/pull/2852#discussion_r678800656



##########
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:
       Yes, I think changing the field to be `Integer` is enough to address this issue.




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


[GitHub] [iceberg] openinx merged pull request #2852: Core: Fix the NPE in DataFiles.Builder#copy

Posted by GitBox <gi...@apache.org>.
openinx merged pull request #2852:
URL: https://github.com/apache/iceberg/pull/2852


   


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


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

Posted by GitBox <gi...@apache.org>.
openinx commented on pull request #2852:
URL: https://github.com/apache/iceberg/pull/2852#issuecomment-888874859


   Got this merged, thanks all for reviewing !


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


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

Posted by GitBox <gi...@apache.org>.
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