the-other-tim-brown commented on code in PR #13742:
URL: https://github.com/apache/hudi/pull/13742#discussion_r2308943041
##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/DefaultSparkRecordMerger.java:
##########
@@ -37,46 +35,38 @@
*/
public class DefaultSparkRecordMerger extends HoodieSparkRecordMerger {
- private String[] orderingFields;
-
@Override
public String getMergingStrategy() {
return HoodieRecordMerger.EVENT_TIME_BASED_MERGE_STRATEGY_UUID;
}
@Override
- public Option<Pair<HoodieRecord, Schema>> merge(HoodieRecord older, Schema
oldSchema, HoodieRecord newer, Schema newSchema, TypedProperties props) throws
IOException {
- Option<Pair<HoodieRecord, Schema>> deleteHandlingResult =
handleDeletes(older, oldSchema, newer, newSchema, props);
- if (deleteHandlingResult != null) {
- return deleteHandlingResult;
- }
-
- if (orderingFields == null) {
- orderingFields = ConfigUtils.getOrderingFields(props);
- }
- if (older.getOrderingValue(oldSchema, props,
orderingFields).compareTo(newer.getOrderingValue(newSchema, props,
orderingFields)) > 0) {
- return Option.of(Pair.of(older, oldSchema));
+ public <T> BufferedRecord<T> merge(BufferedRecord<T> older,
BufferedRecord<T> newer, RecordContext<T> recordContext, TypedProperties props)
throws IOException {
+ if (older.getOrderingValue().compareTo(newer.getOrderingValue()) > 0) {
Review Comment:
Updated the mergers with a helper method and some inline comments attempting
to explain the reason for the special case
--
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]