You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "David Mollitor (Jira)" <ji...@apache.org> on 2020/10/02 13:58:00 UTC

[jira] [Created] (HIVE-24226) Avoid Copy of Bytes in Protobuf BinaryWriter

David Mollitor created HIVE-24226:
-------------------------------------

             Summary: Avoid Copy of Bytes in Protobuf BinaryWriter
                 Key: HIVE-24226
                 URL: https://issues.apache.org/jira/browse/HIVE-24226
             Project: Hive
          Issue Type: Improvement
            Reporter: David Mollitor
            Assignee: David Mollitor


{code:java|title=ProtoWriteSupport.java}
  class BinaryWriter extends FieldWriter {
    @Override
    final void writeRawValue(Object value) {
      ByteString byteString = (ByteString) value;
      Binary binary = Binary.fromConstantByteArray(byteString.toByteArray());
      recordConsumer.addBinary(binary);
    }
  }
{code}

{{toByteArray()}} creates a copy of the buffer.  There is already support with Parquet and Protobuf to pass instead a ByteBuffer which avoids the copy.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)