danny0405 commented on code in PR #9809:
URL: https://github.com/apache/hudi/pull/9809#discussion_r1341883199
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieMergeHandle.java:
##########
@@ -310,8 +310,19 @@ private boolean writeRecord(HoodieRecord<T> newRecord,
Option<HoodieRecord> comb
}
try {
if (combineRecord.isPresent() && !combineRecord.get().isDelete(schema,
config.getProps()) && !isDelete) {
- writeToFile(newRecord.getKey(), combineRecord.get(), schema, prop,
preserveMetadata && useWriterSchemaForCompaction);
- recordsWritten++;
+ // Last-minute check.
+ Pair<Boolean, Boolean> decision =
recordMerger.shouldFlush(combineRecord.get(), schema);
+
+ if (decision.getLeft()) { // CASE (1): Flush the merged record.
+ writeToFile(newRecord.getKey(), combineRecord.get(), schema, prop,
preserveMetadata && useWriterSchemaForCompaction);
+ recordsWritten++;
+ } else {
+ if (decision.getRight()) { // CASE (2): Flush the old record only.
+ return false;
Review Comment:
Thanks for the fix, we might need some unit tests for this new merger
interface, with three different combinations of the returned pair: (true, _),
(false, true), (false, false).
--
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]