pvary commented on code in PR #8553:
URL: https://github.com/apache/iceberg/pull/8553#discussion_r1324311671
##########
flink/v1.17/flink/src/main/java/org/apache/iceberg/flink/source/split/SplitComparators.java:
##########
@@ -56,4 +57,20 @@ public static SerializableComparator<IcebergSourceSplit>
fileSequenceNumber() {
}
};
}
+
+ /** Comparator which orders the splits based on watermark of the splits */
+ public static SerializableComparator<IcebergSourceSplit> watermarkComparator(
+ IcebergEventTimeExtractor<?> eventTimeExtractor) {
+ return (IcebergSourceSplit o1, IcebergSourceSplit o2) -> {
+ long seq1 = eventTimeExtractor.extractWatermark(o1);
+ long seq2 = eventTimeExtractor.extractWatermark(o2);
+
+ int temp = Long.compare(seq1, seq2);
+ if (temp != 0) {
+ return temp;
+ } else {
+ return o1.splitId().compareTo(o2.splitId());
+ }
Review Comment:
done
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]