gianm commented on code in PR #16849:
URL: https://github.com/apache/druid/pull/16849#discussion_r1708052963
##########
processing/src/main/java/org/apache/druid/segment/incremental/OnheapIncrementalIndex.java:
##########
@@ -918,4 +940,84 @@ public void clear()
facts.clear();
}
}
+
+ static final class PlainNonTimeOrderedFactsHolder implements FactsHolder
+ {
+ private final Deque<IncrementalIndexRow> facts;
+ private final Comparator<IncrementalIndexRow>
incrementalIndexRowComparator;
+ private volatile long minTime = DateTimes.MAX.getMillis();
+ private volatile long maxTime = DateTimes.MIN.getMillis();
+
+ public PlainNonTimeOrderedFactsHolder(Comparator<IncrementalIndexRow>
incrementalIndexRowComparator)
+ {
+ this.facts = new ArrayDeque<>();
+ this.incrementalIndexRowComparator = incrementalIndexRowComparator;
+ }
+
+ @Override
+ public int getPriorIndex(IncrementalIndexRow key)
+ {
+ // always return EMPTY_ROW_INDEX to indicate that no prior key cause we
always add new row
+ return IncrementalIndexRow.EMPTY_ROW_INDEX;
+ }
+
+ @Override
+ public long getMinTimeMillis()
+ {
+ return minTime;
+ }
+
+ @Override
+ public long getMaxTimeMillis()
+ {
+ return maxTime;
+ }
+
+ @Override
+ public Iterator<IncrementalIndexRow> iterator(boolean descending)
Review Comment:
It seemed to make more sense to implement it here rather than throw an
error. I suppose in theory there could be a use case, in the future, for
situations like `ORDER BY userId DESC` when the segment is sorted by `userId`.
--
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]