kbendick commented on a change in pull request #1334:
URL: https://github.com/apache/iceberg/pull/1334#discussion_r471899489



##########
File path: pig/src/main/java/org/apache/iceberg/pig/IcebergPigInputFormat.java
##########
@@ -246,7 +246,11 @@ private boolean advance() throws IOException {
     private Object convertPartitionValue(Type type, Object value) {
       if (type.typeId() == Types.BinaryType.get().typeId()) {
         ByteBuffer buffer = (ByteBuffer) value;
-        return new DataByteArray(buffer.get(new 
byte[buffer.remaining()]).array());
+        byte[] bytes = new byte[buffer.remaining()];
+        buffer.get(bytes);
+        // Return the input buffer back to its original position.
+        buffer.position(buffer.position() - bytes.length);
+        return new DataByteArray(bytes);

Review comment:
       Ok. I will update this one to use `slice` to avoid having to restore the 
original buffer's state.




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

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to