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

refactor: Cleanup unused fetch field inside ExternalSorter #15525

Merged
merged 1 commit into from
Apr 2, 2025

Conversation

2010YOUY01
Copy link
Contributor

Which issue does this PR close?

  • Closes #.

Rationale for this change

ExternalSorter supports fetch field for 'TopK' queries (e.g. SELECT .... ORDER BY c1 LIMIT 10), however it's not used now inside DataFusion. This might be due to ExternalSorter with limit is first implemented, and later a more optimized TopK data structure is used instead for such query pattern.
This fetch field then can be removed for simplicity.

What changes are included in this PR?

Remove fetch field inside ExternalSorter

Are these changes tested?

Existing tests.

Are there any user-facing changes?

No, ExternalSorter is not a public interface.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @2010YOUY01 -- I think it makes sense to me to remove unused code

I think this functionality would be used to implement ORDER BY LIMIT <VERY LARGE NUMBER> -- aka where the TopK rows wouldn't fit into the memory budget

However given the lack of test coverage it is clear this code is not used anymore

Perhaps you can also file a ticket to track supporting "topK" queries with limited memory when the K is "large"?

@2010YOUY01
Copy link
Contributor Author

Thanks @2010YOUY01 -- I think it makes sense to me to remove unused code

I think this functionality would be used to implement ORDER BY LIMIT <VERY LARGE NUMBER> -- aka where the TopK rows wouldn't fit into the memory budget

However given the lack of test coverage it is clear this code is not used anymore

Perhaps you can also file a ticket to track supporting "topK" queries with limited memory when the K is "large"?

Thank you.

In order to support external TopK, I wrote up the idea in #15538

@alamb alamb merged commit f20e2e2 into apache:main Apr 2, 2025
27 checks passed
@alamb
Copy link
Contributor

alamb commented Apr 2, 2025

Thanks @2010YOUY01 and @xudong963

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

Successfully merging this pull request may close these issues.

3 participants