kbendick commented on a change in pull request #1334:
URL: https://github.com/apache/iceberg/pull/1334#discussion_r479623220
##########
File path: data/src/main/java/org/apache/iceberg/data/orc/GenericOrcWriters.java
##########
@@ -231,7 +234,13 @@ public void nonNullWrite(int rowId, String data,
ColumnVector output) {
@Override
public void nonNullWrite(int rowId, ByteBuffer data, ColumnVector output) {
- ((BytesColumnVector) output).setRef(rowId, data.array(), 0,
data.array().length);
+ if (data != null && data.hasArray()) {
+ ((BytesColumnVector) output).setRef(rowId, data.array(),
data.arrayOffset() + data.position(), data.remaining());
+ } else {
+ byte[] rawData = ByteBuffers.toByteArray(data);
+ int length = rawData == null ? 0 : rawData.length;
+ ((BytesColumnVector) output).setRef(rowId, rawData, 0, length);
Review comment:
@rdblue please let me know if this is an appropriate use of
`ByteBuffers.toByteArray` (since we know this is off-heap, I figure this brings
it on heap in the way I was somewhat before).
And is the null check necessary? I saw that `toByteArray` returned null if
`null` was passed in, and I didn't see any `@NonNull` kind of tags so I wasn't
sure.
----------------------------------------------------------------
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]