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

pkg/query: Sort list in aggregateTopByFunction #879

Merged
merged 1 commit into from
Apr 5, 2022

Conversation

importhuman
Copy link
Contributor

Follow-up PR after discussion in #847. Sorts by descending flat value by default, but if flat value is same, sorts by ascending meta location address (this second case is needed currently for the tests to pass every time).

This sorts the list by descending flat value by default, unless
it encounters the same value, in which case sorting is done by
ascending meta location address. (parca-dev#770)
return list[i].Meta.Location.Address < list[j].Meta.Location.Address
// If flat value is equal, sort by address, ascending
if list[i].Flat == list[j].Flat {
return list[i].Meta.Location.Address < list[j].Meta.Location.Address
Copy link
Member

Choose a reason for hiding this comment

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

Nice catch!

@brancz
Copy link
Member

brancz commented Apr 5, 2022

Thank you so much!

@brancz brancz merged commit 47c9e14 into parca-dev:main Apr 5, 2022
@importhuman importhuman deleted the fix-flaky-test branch April 5, 2022 18:43
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.

None yet

2 participants