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

Replace recursive with loop in PackedValuesBlockHash #99992

Merged
merged 9 commits into from
Sep 29, 2023

Conversation

dnhatn
Copy link
Member

@dnhatn dnhatn commented Sep 28, 2023

This change replaces the recursion with a loop when packing and hashing multiple keys. While the recursive version is clever, it may not be as straightforward for future readers. Using a loop also helps us avoid StackOverflow when grouping by a large number of keys.

@dnhatn dnhatn marked this pull request as ready for review September 28, 2023 06:00
@dnhatn dnhatn requested a review from nik9000 September 28, 2023 06:00
@elasticsearchmachine elasticsearchmachine added the Team:QL (Deprecated) Meta label for query languages team label Sep 28, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-ql (Team:QL)

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/elasticsearch-esql (:Query Languages/ES|QL)

@dnhatn
Copy link
Member Author

dnhatn commented Sep 28, 2023

@nik9000 Please hold off the review. This doesn't pass all our tests.

@dnhatn
Copy link
Member Author

dnhatn commented Sep 28, 2023

@nik9000 I think this is ready for review. Would you please take a look? Thank you!

@dnhatn dnhatn requested review from nik9000 and removed request for nik9000 September 28, 2023 17:37
final BytesRef scratch = new BytesRef();
final int[] loopedIndices = new int[groups.size()];
final int[] valueCounts = new int[groups.size()];
final int[] bytesStarts = new int[groups.size()];
Copy link
Member

Choose a reason for hiding this comment

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

I think we'd be better of making an object for each group and have an array of those. But whatever works for you.

Copy link
Member Author

Choose a reason for hiding this comment

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

++, will do.

Copy link
Member Author

Choose a reason for hiding this comment

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

I pushed f41c6e8, which is much cleaner.

@dnhatn
Copy link
Member Author

dnhatn commented Sep 28, 2023

@nik9000 Thank you for the review.

@dnhatn dnhatn merged commit 44a2d68 into elastic:main Sep 29, 2023
@dnhatn dnhatn deleted the packed-hash-remove-recursive branch September 29, 2023 00:45
piergm pushed a commit to piergm/elasticsearch that referenced this pull request Oct 2, 2023
This change replaces the recursion with a loop when packing and hashing 
multiple keys. While the recursive version is clever, it may not be as
straightforward for future readers. Using a loop also helps us avoid
StackOverflow when grouping by a large number of keys.
jakelandis pushed a commit to jakelandis/elasticsearch that referenced this pull request Oct 2, 2023
This change replaces the recursion with a loop when packing and hashing 
multiple keys. While the recursive version is clever, it may not be as
straightforward for future readers. Using a loop also helps us avoid
StackOverflow when grouping by a large number of keys.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL >non-issue Team:QL (Deprecated) Meta label for query languages team v8.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants