manojpec commented on a change in pull request #4449:
URL: https://github.com/apache/hudi/pull/4449#discussion_r792084007



##########
File path: 
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/storage/HoodieHFileWriter.java
##########
@@ -122,7 +128,17 @@ public boolean canWrite() {
 
   @Override
   public void writeAvro(String recordKey, IndexedRecord object) throws 
IOException {
-    byte[] value = HoodieAvroUtils.avroToBytes((GenericRecord)object);
+    byte[] value = HoodieAvroUtils.avroToBytes((GenericRecord) object);

Review comment:
       I replied in the comment on why this has to be done by the other way.
   
   The passed in object cannot be modified in this writeAvro() method. The 
caller if at all uses the record again will find the key missing and crash when 
dereferencing it. So, we need to empty the key and restore back the original 
key in the record so that the caller is not affected. Please take a look at the 
latest commit on the fix for this.

##########
File path: 
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/storage/HoodieHFileConfig.java
##########
@@ -97,4 +99,8 @@ public BloomFilter getBloomFilter() {
   public KeyValue.KVComparator getHfileComparator() {
     return hfileComparator;
   }
+
+  public String getKeyFieldName() {

Review comment:
       I see this already fixed by your commit.




-- 
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]


Reply via email to