pnowojski commented on code in PR #24211:
URL: https://github.com/apache/flink/pull/24211#discussion_r1495762047


##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/wmassigners/WatermarkAssignerOperator.java:
##########
@@ -100,11 +100,14 @@ public void open() throws Exception {
 
     @Override
     public void processElement(StreamRecord<RowData> element) throws Exception 
{
-        if (idleTimeout > 0 && currentStatus.equals(WatermarkStatus.IDLE)) {
-            // mark the channel active
-            emitWatermarkStatus(WatermarkStatus.ACTIVE);
+        if (idleTimeout > 0) {
+            if (currentStatus.equals(WatermarkStatus.IDLE)) {
+                // mark the channel active
+                emitWatermarkStatus(WatermarkStatus.ACTIVE);
+            }
             lastRecordTime = 
getProcessingTimeService().getCurrentProcessingTime();
         }

Review Comment:
   > A workaround solution is we only register a timer with min(idleTimeout, 
watermarkInterval) latency.
   
   Does `idleTimeout < watermarkInterval` have any sense? Shouldn't this be 
disallowed even? But if you have doubts, we can support that case here.
   
   Given that when timer is registered for value `<> watermarkInterval`, and in 
that case we need some special handling in the timer callback, whether it's 
time to emit watermark or not, maybe it makes more sense to calculate some more 
fancy timer interval? For example:
   ```
   if min(watermarkInterval, idleTimeout) * 5  < max(watermarkInterval, 
idleTimeout)
     return min(watermarkInterval, idleTimeout)
   else 
     return max(min(watermarkInterval, idleTimeout)/5, 1)
   ```
   That would ensure our accuracy is roughly speaking always good enough? And 
the code in the callback to determine whether it's time to check idleness 
and/or emit watermark would basically remain the same.
   
   > We can register a timer with idleTimeout latency.
   
   Yes, that's what I had in mind :) 



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

Reply via email to