Skip to content
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

A complete solution for stable and safe sort with spill #14692

Open
Tracked by #14077
zhuqi-lucas opened this issue Feb 16, 2025 · 1 comment
Open
Tracked by #14077

A complete solution for stable and safe sort with spill #14692

zhuqi-lucas opened this issue Feb 16, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@zhuqi-lucas
Copy link
Contributor

zhuqi-lucas commented Feb 16, 2025

Is your feature request related to a problem or challenge?

This is a follow-up for #14644:

See details in #14644 (comment) cc @alamb @Kontinuation

We need a complete solution about stable sort with spill, several issues until now:

  1. Ensuring we can always spill data (now spilling will sometimes fail if we run out of memory to sort the batches in)
  2. Ensuring that we can always merge the data that was spilled, even if it had a really wide fanout (like 1000 of spill files)

The problem 1 could be solved by potentially spilling unsorted batches (and then sorting them separately). This would be less efficient (read/write some tuples twice but would work.

Problem 2 could use the multi-pass merge:

We can implement a more complicated multi-stage merging phase which merges a small portion of streams each time, and perform multiple rounds of merges to produce the final merged stream.

Describe the solution you'd like

The problem 1 could be solved by potentially spilling unsorted batches (and then sorting them separately). This would be less efficient (read/write some tuples twice but would work.

Problem 2 could use the multi-pass merge:

We can implement a more complicated multi-stage merging phase which merges a small portion of streams each time, and perform multiple rounds of merges to produce the final merged stream.

Describe alternatives you've considered

No response

Additional context

No response

@alamb
Copy link
Contributor

alamb commented Feb 19, 2025

Thank you for filing this @zhuqi-lucas . I have also added it to our list here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants