gianm commented on code in PR #16533:
URL: https://github.com/apache/druid/pull/16533#discussion_r1704301823
##########
processing/src/main/java/org/apache/druid/segment/Cursor.java:
##########
@@ -35,11 +36,45 @@
*/
public interface Cursor
{
+ /**
+ * Get a {@link ColumnSelectorFactory} whose selectors will be backed by the
row values at the current position of
+ * the cursor
+ */
ColumnSelectorFactory getColumnSelectorFactory();
- DateTime getTime();
+
+ /**
+ * Advance to the next row in the cursor, checking if thread has been
interrupted after advancing and possibly
+ * throwing {@link QueryInterruptedException} if so
+ */
void advance();
+
+ /**
+ * Advance to the next row in the cursor
+ */
void advanceUninterruptibly();
+
+ /**
+ * Check if there are any additional rows in the cursor
+ */
boolean isDone();
+
+ /**
+ * Check if there are any additional rows in the cursor, or if the thread
has been interrupted
+ */
boolean isDoneOrInterrupted();
+
+ /**
+ * Mark a position on the cursor which can recalled with {@link
#resetToMark()}
+ */
+ void mark(DateTime mark);
Review Comment:
I think it could still use more clarification. If I'm writing a query engine
that isn't topN, and thinking that I might want to use the `mark(DateTime)`
method, this javadoc doesn't tell me enough about what it does.
Specifically I wonder: when a cursor implementation decides to use the
`DateTime mark` instead of the current offset, what behavior can I expect? Will
`resetToMark()` reset to the first row with that timestamp? Any row with that
timestamp? What if no rows have that particular timestamp-- will it reset to
the first row with a timestamp greater than the marked timestamp? Are there any
situations where behavior is undefined or where I'd get an error?
It also feels useful to call out what the expected value for `DateTime mark`
is. Is it expected to match the `__time` value of the current row?
--
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]