pvary commented on code in PR #15884:
URL: https://github.com/apache/iceberg/pull/15884#discussion_r3131656659


##########
flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/source/reader/WatermarkExtractorRecordEmitter.java:
##########
@@ -44,7 +44,10 @@ class WatermarkExtractorRecordEmitter<T> implements 
SerializableRecordEmitter<T>
   public void emitRecord(
       RecordAndPosition<T> element, SourceOutput<T> output, IcebergSourceSplit 
split) {
     if (!split.splitId().equals(lastSplitId)) {
-      long newWatermark = timeExtractor.extractWatermark(split);
+      long extracted = timeExtractor.extractWatermark(split);
+      // Subtract 1 because watermark W means all records with eventTime <= W 
have arrived;
+      // records in this split have eventTime == extracted, so watermark must 
be extracted - 1.
+      long newWatermark = extracted > Long.MIN_VALUE ? extracted - 1 : 
Long.MIN_VALUE;

Review Comment:
   We would convert `Long.MAX_VALUE` to `Long.MAX_VALUE-1`. Isn't this a 
problem?



-- 
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]

Reply via email to