wzx140 commented on code in PR #5522:
URL: https://github.com/apache/hudi/pull/5522#discussion_r873368687
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieMergeHandle.java:
##########
@@ -257,46 +255,45 @@ protected void init(String fileId,
Iterator<HoodieRecord<T>> newRecordsItr) {
+ ((ExternalSpillableMap)
keyToNewRecords).getSizeOfFileOnDiskInBytes());
}
- private boolean writeUpdateRecord(HoodieRecord<T> hoodieRecord,
GenericRecord oldRecord, Option<IndexedRecord> indexedRecord) {
+ private boolean writeUpdateRecord(HoodieRecord<T> hoodieRecord,
HoodieRecord<T> oldRecord, Option<HoodieRecord> combineRecordOp) throws
IOException {
boolean isDelete = false;
- if (indexedRecord.isPresent()) {
+ Schema schema = useWriterSchemaForCompaction ? tableSchemaWithMetaFields :
tableSchema;
+ if (combineRecordOp.isPresent()) {
updatedRecordsWritten++;
- GenericRecord record = (GenericRecord) indexedRecord.get();
- if (oldRecord != record) {
+ if (!oldRecord.equals(combineRecordOp.get())) {
// the incoming record is chosen
isDelete = HoodieOperation.isDelete(hoodieRecord.getOperation());
}
}
- return writeRecord(hoodieRecord, indexedRecord, isDelete);
+ return writeRecord(hoodieRecord, combineRecordOp, schema,
config.getProps(), isDelete);
}
protected void writeInsertRecord(HoodieRecord<T> hoodieRecord) throws
IOException {
Schema schema = useWriterSchemaForCompaction ? tableSchemaWithMetaFields :
tableSchema;
- Option<IndexedRecord> insertRecord =
hoodieRecord.getData().getInsertValue(schema, config.getProps());
// just skip the ignored record
- if (insertRecord.isPresent() && insertRecord.get().equals(IGNORE_RECORD)) {
+ if (hoodieRecord.shouldIgnore(schema, config.getProps())) {
return;
}
- if (writeRecord(hoodieRecord, insertRecord,
HoodieOperation.isDelete(hoodieRecord.getOperation()))) {
+ if (writeRecord(hoodieRecord, Option.of(hoodieRecord), schema,
config.getProps(), HoodieOperation.isDelete(hoodieRecord.getOperation()))) {
Review Comment:
Because operation has nothing to do with record type, it is unnecessary to
add isdelete api to record.
--
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]