599166320 commented on PR #13031:
URL: https://github.com/apache/druid/pull/13031#issuecomment-1240942976

   > [599166320](https://github.com/599166320), thanks for your contribution! 
The native query engines are quite complex. See the comments for a few things 
to think about.
   > 
   > As it turns out, we have been discussing the idea of using an operator 
approach to native queries. There is an issue with the discussion, and a 
now-closed PR with a first approach. Adding this sort operation would be _so_ 
much simpler using that operator approach. That PR actually converted the scan 
query to use operators.
   > 
   > So, an alternative to this approach is to get that operator-based version 
of scan query committed, then add a sort operator. The merge operators that 
exist can be reused for the merge part of the sort/merge operation.
   > 
   > Finally, it is worth noting that if the user asks to sort by a single 
dimension, and Druid has already sorted that dimension, perhaps we can reuse 
that sort order to avoid the need to sort again. If the key is compound 
(multiple keys), then we would need to sort. This is the kind of "optimization" 
decision that the operator approach makes easier.
   
   
   
   > 
   
   
   Thank you for your wonderful introduction to `operator-based` and `Volcano` 
(# 12641). This scheme is very helpful to the optimization of query engines. I 
also see that Druid is moving in this direction.
   
   
   To get back to the point, if the user arranges the order in advance, it 
really does not need to be sorted again. At present, this PR temporarily solves 
the orderby problem of Druid ordinary columns. If it contains sorted columns, 
such as`__ime `, and the sorting algorithm mentioned in this PR will not be 
executed.
   
   The logic of this judgment is mainly encapsulated in 
`ScanQuery.scanOrderByNonTime`.


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