manojpec commented on a change in pull request #4067:
URL: https://github.com/apache/hudi/pull/4067#discussion_r756702573
##########
File path:
hudi-common/src/main/java/org/apache/hudi/common/table/log/block/HoodieHFileDataBlock.java
##########
@@ -162,6 +167,18 @@ protected void createRecordsFromContentBytes() throws
IOException {
return records;
}
+ /**
+ * Serialize the record to byte buffer.
+ *
+ * @param record - Record to serialize
+ * @param schemaKeyField - Key field in the schema
+ * @return Serialized byte buffer for the record
+ */
+ protected ByteBuffer serializeRecord(final IndexedRecord record, final
Option<Field> schemaKeyField) {
+ ValidationUtils.checkArgument(record.getSchema() != null, "Unknown schema
for the record!");
+ return ByteBuffer.wrap(HoodieAvroUtils.indexedRecordToBytes(record));
Review comment:
Since this serializeRecord() method is intended for overloading by the
derived classes, want the interface to be much more expressive than the
primitive array type. In the current implementation, ByteBuffer.wrap() is only
a "view" of the backing single copy of the record byte array and has the same
performance as that of byte[] . Additionally, the caller can work on the
returned ByteBuffer to peek/parse/duplicate the content as needed. Right, we
aren't using any of this in the current implementation. I am ok to change this
to byte[].
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]