danny0405 commented on code in PR #9809: URL: https://github.com/apache/hudi/pull/9809#discussion_r1343410059
########## hudi-common/src/main/java/org/apache/hudi/common/model/HoodieRecordMerger.java: ########## @@ -46,6 +46,28 @@ public interface HoodieRecordMerger extends Serializable { */ Option<Pair<HoodieRecord, Schema>> merge(HoodieRecord older, Schema oldSchema, HoodieRecord newer, Schema newSchema, TypedProperties props) throws IOException; + + /** + * In some cases a business logic does some checks before flushing a merged record to the disk. + * This method does the check and the returned value contains two boolean variables. + * <p> + * The first variable indicates if the merged record should be flushed to the disk or not. + * The second variable takes effect only when the first one is false, and it indicates if + * the old record should be kept or not. That is, + * (1) (true, _): the merged one is flushed to the disk; the old record is skipped. + * (2) (false, false): both records skipped, a delete operation. + * (3) (false, true): only the old record flushed to the disk. + * + * @param record the merged record. + * @param schema the schema of the merged record. + * @return a pair of boolean variables to indicate the flush decision. + * + * <p> This interface is experimental and might be evolved in the future. + **/ + default Pair<Boolean, Boolean> shouldFlush(HoodieRecord record, Schema schema, TypedProperties props) throws IOException { Review Comment: > If it's going to be simple enough to just decide whether to flush or not I kind of agree, we can simplify the returned value as a true/false. But maybe @linliu-code has some other considerations here, @linliu-code can you clarify. > Then we add another method? I think we may change the method signature directly, by marking this method as expremental, we do not guarantee any compatibility in future versions. And because we have a default impl, so it should be feasible. -- 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: commits-unsubscr...@hudi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org