jtuglu1 commented on code in PR #18855:
URL: https://github.com/apache/druid/pull/18855#discussion_r2636053627


##########
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/SeekableStreamIndexTaskRunner.java:
##########
@@ -2144,26 +2146,36 @@ private void refreshMinMaxMessageTime()
     );
   }
 
-  public boolean withinMinMaxRecordTime(final InputRow row)
+  /**
+   * Returns the rejection reason for a row, or null if the row should be 
accepted.
+   * This method is used as a {@link RowFilter} for the {@link 
StreamChunkParser}.
+   */
+  @Nullable
+  ThrownAwayReason getRowRejectionReason(final InputRow row)
   {
-    final boolean beforeMinimumMessageTime = 
minMessageTime.isAfter(row.getTimestamp());
-    final boolean afterMaximumMessageTime = 
maxMessageTime.isBefore(row.getTimestamp());
-
-    if (log.isDebugEnabled()) {
-      if (beforeMinimumMessageTime) {
+    if (row == null) {
+      return ThrownAwayReason.NULL;
+    }
+    if (minMessageTime.isAfter(row.getTimestamp())) {
+      if (log.isDebugEnabled()) {
         log.debug(
             "CurrentTimeStamp[%s] is before MinimumMessageTime[%s]",
             row.getTimestamp(),
             minMessageTime
         );
-      } else if (afterMaximumMessageTime) {
+      }
+      return ThrownAwayReason.BEFORE_MIN_MESSAGE_TIME;
+    }
+    if (maxMessageTime.isBefore(row.getTimestamp())) {
+      if (log.isDebugEnabled()) {
         log.debug(
             "CurrentTimeStamp[%s] is after MaximumMessageTime[%s]",
             row.getTimestamp(),
             maxMessageTime
         );
       }
+      return ThrownAwayReason.AFTER_MAX_MESSAGE_TIME;
     }
-    return !beforeMinimumMessageTime && !afterMaximumMessageTime;
+    return null;

Review Comment:
   Actually, I'd like to leave this as-is. I don't see a reason to use this 
`RowFilterResult.Accepted` anywhere else other than to actually check whether 
the result was accepted/denied (for incrementing a thrown away counter). That's 
really no better than checking against `null`. We wouldn't be tracking counters 
for this enum value as we already have metrics for ingest row counters. It's 
not a breaking change on user-side, so if this turns out to be the wrong 
approach, we can always switch it out under-the-hood (the change is simple).



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