rdblue commented on a change in pull request #1334:
URL: https://github.com/apache/iceberg/pull/1334#discussion_r470762678
##########
File path: pig/src/main/java/org/apache/iceberg/pig/IcebergPigInputFormat.java
##########
@@ -243,6 +243,7 @@ private boolean advance() throws IOException {
return true;
}
+ @SuppressWarnings("ByteBufferBackingArray")
Review comment:
I don't think this is correct. This calls `buffer.get(new byte[...])`,
which returns the `ByteBuffer` that `get` was called on. It is no different
than returning `new DataByteArray(buffer.array())`. Calling `get` shows that
the intent was to read the bytes into a new array and pass that to create a
`DataByteArray`.
The correct implementation is this:
```java
ByteBuffer buffer = (ByteBuffer) value;
byte[] bytes = new byte[buffer.remaining()];
buffer.get(bytes);
return new DataByteArray(bytes);
```
----------------------------------------------------------------
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]