GroupBy: When possible, sort results on read rather than continuously during insert.#2871
Closed
gianm wants to merge 1 commit intoapache:masterfrom
Closed
GroupBy: When possible, sort results on read rather than continuously during insert.#2871gianm wants to merge 1 commit intoapache:masterfrom
gianm wants to merge 1 commit intoapache:masterfrom
Conversation
… during insert. Leans on the logic from apache#2571 with respect to deciding when to sort and when not to sort.
| final Comparator<TimeAndDims> comparator = descending | ||
| ? Ordering.from(dimsComparator()).reverse() | ||
| : dimsComparator(); | ||
| List<Map.Entry<TimeAndDims, Integer>> factsList = Lists.newArrayList(getFacts().entrySet()); |
Contributor
There was a problem hiding this comment.
this may be ok for on-heap index but will unexpectedly put everything on-heap even for any off-heap implementation of IncrementalIndex (for example #2847 )
one option would be to update QueryToolChest to not exercise this path when off-heap merging was requested.
Contributor
Author
There was a problem hiding this comment.
I was thinking that for the current offheap impl this is fine (even the offheap one still has an onheap facts map) but things are different if the facts map is offheap.
I am ok waiting on this PR until #2847 is settled and then figuring out what is best.
Contributor
Author
|
closing for now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Leans on the logic from #2571 with respect to deciding when to sort and when not to sort.
This does involve somewhat more memory use (need to copy the facts to a list and then sort the list). But as the list is just references to already-existing Map.Entry objects, the overhead shouldn't be too bad.
Before:
After:
Depends on #2870