cshuo commented on code in PR #13686:
URL: https://github.com/apache/hudi/pull/13686#discussion_r2264598016


##########
hudi-common/src/main/java/org/apache/hudi/common/model/HoodieAvroIndexedRecord.java:
##########
@@ -126,43 +156,54 @@ public Object[] getColumnValues(Schema recordSchema, 
String[] columns, boolean c
 
   @Override
   public Object getColumnValueAsJava(Schema recordSchema, String column, 
Properties props) {
+    decodeRecord(recordSchema);
     return AvroRecordContext.getFieldValueFromIndexedRecord(data, column);
   }
 
   @Override
   public HoodieRecord joinWith(HoodieRecord other, Schema targetSchema) {
+    decodeRecord(targetSchema);
     GenericRecord record = HoodieAvroUtils.stitchRecords((GenericRecord) data, 
(GenericRecord) other.getData(), targetSchema);
     return new HoodieAvroIndexedRecord(key, record, operation, metaData);
   }
 
   @Override
   public HoodieRecord prependMetaFields(Schema recordSchema, Schema 
targetSchema, MetadataValues metadataValues, Properties props) {
+    decodeRecord(recordSchema);
     GenericRecord newAvroRecord = 
HoodieAvroUtils.rewriteRecordWithNewSchema(data, targetSchema);
     updateMetadataValuesInternal(newAvroRecord, metadataValues);
     return new HoodieAvroIndexedRecord(key, newAvroRecord, operation, 
metaData);
   }
 
   @Override
   public HoodieRecord updateMetaField(Schema recordSchema, int ordinal, String 
value) {
+    decodeRecord(recordSchema);
     data.put(ordinal, value);
     return new HoodieAvroIndexedRecord(key, data, operation, metaData);
   }
 
   @Override
   public HoodieRecord rewriteRecordWithNewSchema(Schema recordSchema, 
Properties props, Schema newSchema, Map<String, String> renameCols) {
+    decodeRecord(recordSchema);
     GenericRecord record = HoodieAvroUtils.rewriteRecordWithNewSchema(data, 
newSchema, renameCols);
     return new HoodieAvroIndexedRecord(key, record, operation, metaData);
   }
 
   @Override
   public HoodieRecord truncateRecordKey(Schema recordSchema, Properties props, 
String keyFieldName) {
+    decodeRecord(recordSchema);
     ((GenericRecord) data).put(keyFieldName, StringUtils.EMPTY_STRING);
     return this;
   }
 
   @Override
   protected boolean checkIsDelete(Schema recordSchema, Properties props) {
-    return false;
+    if (getData().equals(SENTINEL)) {
+      return false; // Sentinel record is not a delete
+    }
+    decodeRecord(recordSchema);
+    DeleteContext deleteContext = new DeleteContext(props, recordSchema);
+    return AVRO_RECORD_CONTEXT.isDeleteRecord(data, deleteContext);

Review Comment:
   We should call `deleteContext.withReaderSchema()` before this?



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