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

executor: support TopN #404

Closed
2 tasks
skyzh opened this issue Feb 3, 2022 · 3 comments · Fixed by #446
Closed
2 tasks

executor: support TopN #404

skyzh opened this issue Feb 3, 2022 · 3 comments · Fixed by #446
Labels
enhancement New feature or request

Comments

@skyzh
Copy link
Member

skyzh commented Feb 3, 2022

When running TPC-H queries, it is possible that we have limit with order by. We can optimize this into TopN.

@skyzh skyzh mentioned this issue Feb 3, 2022
13 tasks
@skyzh skyzh added the enhancement New feature or request label Feb 3, 2022
@TennyZhuang
Copy link
Collaborator

The binary-heap-plus crate may be helpful to the issue with the comparator-api support.

@skyzh
Copy link
Member Author

skyzh commented Feb 6, 2022

The binary-heap-plus crate may be helpful to the issue with the comparator-api support.

That's cool! I originally thought that we might need to hand-write a binary heap as in MergeIterator...

pub struct MergeIterator {
/// All child iterators
///
/// TODO: should be able to accept `ConcatIterator` as parameter.
iters: Vec<SecondaryIterator>,
/// Buffer of data chunks from each iterator
chunk_buffer: Vec<Option<StorageChunk>>,
/// Indicates whether an iterator has reached its end
has_finished: Vec<bool>,
/// The column id to be used as sort key
sort_key_idx: usize,
/// The min-heap of all pending data. Heap will be no larger than
/// `len(iters)` size. Each element represents `(iter_id, batch_row_id)`.
/// As we have to implement a lot of custom compare logic, we have
/// to implement our own binary heap.
pending_heap: Vec<(usize, usize)>,
/// Sometimes we need an array placeholder
dummy_array: Arc<ArrayImpl>,
}

@xxchan
Copy link
Member

xxchan commented Feb 11, 2022

I'd like to try this

@xxchan xxchan mentioned this issue Mar 29, 2022
18 tasks
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

Successfully merging a pull request may close this issue.

3 participants