shanzi commented on code in PR #15884:
URL: https://github.com/apache/iceberg/pull/15884#discussion_r3134943935
##########
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:
This extracted value comes from the iceberg data, if there is a split whose
minimum value is `Long.MAX_VALUE`, it will become `Long.MAX_VALUE - 1`.
However, it is as expected because that `Long.MAX_VALUE` is a data record,
instead of a source terminates flag.
I believe when a source terminates, the `Long.MAX_VALUE` will not be emitted
throw this way. It goes directly to subsequent operators.
--
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]