-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Simplify io.trino.spi.PageSorter interface #26965
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
Conversation
Engine can provide the sorted Pages directly to the connector. This avoids code duplication in connector and lets the engine avoid exposing internal details around PagesIndex#sort output
Reviewer's GuideThis PR refactors the PageSorter SPI to return sorted Page objects directly instead of synthetic address arrays, removes the decode methods, and updates all engine, connector, test, and benchmark usages to consume the new iterator-based API. Class diagram for updated PageSorter interfaceclassDiagram
class PageSorter {
+Iterator<Page> sort(List<Type> types, List<Page> pages, List<Integer> sortChannels, List<SortOrder> sortOrders, int expectedPositions)
}
class Page
class Type
class SortOrder
PageSorter --> "Iterator<Page>" Page
PageSorter --> Type
PageSorter --> SortOrder
Class diagram for removed methods from PageSorterclassDiagram
class PageSorter {
-long[] sort(...)
-int decodePageIndex(long address)
-int decodePositionIndex(long address)
}
class Page
PageSorter --> Page
Class diagram for updated PagesIndexPageSorter implementationclassDiagram
class PagesIndexPageSorter {
+Iterator<Page> sort(...)
}
class PagesIndex
class Page
PagesIndexPageSorter --> PagesIndex
PagesIndexPageSorter --> "Iterator<Page>" Page
Class diagram for updated SortBuffer usageclassDiagram
class SortBuffer {
-PageBuilder pageBuilder
+void flushTo(Consumer<Page> consumer)
}
class PageSorter
class Page
SortBuffer --> PageSorter
SortBuffer --> Page
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!
Description
Engine can provide the sorted Pages directly to the connector.
This avoids code duplication in connector and lets the engine avoid exposing internal details around PagesIndex#sort output
Additional context and related issues
Release notes
(x) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:
Summary by Sourcery
Simplify the PageSorter SPI to return an iterator of sorted pages directly and eliminate synthetic address manipulation across the engine and connectors.
Enhancements:
Build:
Tests: