This is an automated email from the ASF dual-hosted git repository.

danny0405 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git


The following commit(s) were added to refs/heads/master by this push:
     new 43ea93f9cda [HUDI-8829] Reduce bytes copy during writing avro records 
to log file (#12578)
43ea93f9cda is described below

commit 43ea93f9cda02806f58c8a6205e7cbc1ac2b2080
Author: Shuo Cheng <[email protected]>
AuthorDate: Mon Jan 6 15:45:30 2025 +0800

    [HUDI-8829] Reduce bytes copy during writing avro records to log file 
(#12578)
---
 .../hudi/common/table/log/block/HoodieAvroDataBlock.java     | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git 
a/hudi-common/src/main/java/org/apache/hudi/common/table/log/block/HoodieAvroDataBlock.java
 
b/hudi-common/src/main/java/org/apache/hudi/common/table/log/block/HoodieAvroDataBlock.java
index cf7922ea39a..478e12eb014 100644
--- 
a/hudi-common/src/main/java/org/apache/hudi/common/table/log/block/HoodieAvroDataBlock.java
+++ 
b/hudi-common/src/main/java/org/apache/hudi/common/table/log/block/HoodieAvroDataBlock.java
@@ -124,12 +124,10 @@ public class HoodieAvroDataBlock extends HoodieDataBlock {
           writer.write(data, encoder);
           encoder.flush();
 
-          // Get the size of the bytes
-          int size = temp.toByteArray().length;
           // Write the record size
-          output.writeInt(size);
+          output.writeInt(temp.size());
           // Write the content
-          output.write(temp.toByteArray());
+          temp.writeTo(output);
         } catch (IOException e) {
           throw new HoodieIOException("IOException converting 
HoodieAvroDataBlock to bytes", e);
         }
@@ -341,12 +339,10 @@ public class HoodieAvroDataBlock extends HoodieDataBlock {
           writer.write(s, encoder);
           encoder.flush();
 
-          // Get the size of the bytes
-          int size = temp.toByteArray().length;
           // Write the record size
-          output.writeInt(size);
+          output.writeInt(temp.size());
           // Write the content
-          output.write(temp.toByteArray());
+          temp.writeTo(output);
           itr.remove();
         } catch (IOException e) {
           throw new HoodieIOException("IOException converting 
HoodieAvroDataBlock to bytes", e);

Reply via email to