-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize SortPreservingMergeStream for single-column merge #13642
Comments
take |
Hi @Dandandan does the |
As shown in my flamegraph profile, there are code paths that invoke |
Thanks for the flamegraph, indeed looks like it happens when dealing with working with
and |
It seems single column case is optimized here datafusion/datafusion/physical-plan/src/sorts/streaming_merge.rs Lines 168 to 180 in 8404cd0
|
Is your feature request related to a problem or challenge?
Currently
SortPreservingMergeStream
converts column to row-format even when sorting a single column.We can optimize
SortPreservingMergeStream
to not do this when the sort expression is a single column, which avoids the conversion and makes comparisons faster.Describe the solution you'd like
Optimize the
SortPreservingMergeStream
for single column sorts, only converting to row-format when dealing with multi-column sorts.Describe alternatives you've considered
No response
Additional context
This should be beneficial for many queries involving
SortPreservingMerge
, such as #13586The text was updated successfully, but these errors were encountered: