paul-rogers commented on PR #13168:
URL: https://github.com/apache/druid/pull/13168#issuecomment-1272674781

   
   One more thing to note here is that Druid allows sorting of segments by more 
than just `__time`. We can order (I believe) a segment by, say, `(__time, a, b, 
c)`. In this case, the cursor _should_ be able to sort by any prefix of the 
segment sort order. That is, it should accept an ordering of `(__time)`, 
`(__time, a)`, `(__time, a, b)` or `(__time, a, b, c)`. (I have to check the 
code to verify). If this is true, then the function in this PR that checks if 
we need an "extra" sort has to take this information into consideration, which 
means the decision has to occur segment-by-segment since each segment may have 
a different sort order.
   
   To get even more into the weeds, the cursor should also be able to order by 
the descending version of any prefix, such as `(__time DESC, a DESC, b DESC)`. 
The cursor cannot, however, order by a mixture of ASC/DESC that does not match 
the segment sort order. So, our example segment cannot return rows in an order 
of, say, `(__time, a DESC)`. We _would_ need the extra sort in this case. 
(Again, I need to verify: perhaps Druid has a trick, but most systems don't.)


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