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

Fix hang in distinct aggregation #7968

Closed
wants to merge 1 commit into from

Conversation

mbasmanova
Copy link
Contributor

HashAggregation::addInput receives a batch of inputs, calls
groupingSet_->addInput() which doesn't find any new distinct keys, but
allocates additional memory crossing the threshold and setting partialFull_ to
true.

Note that HashTable::groupProbe may resize hash table and allocate memory even
if there are no new keys. This method always resizes the table to make sure
that if all input is unique, then it will fit into the hash table.

With newDistincts_ false and partialFull_ true, HashAggregation::getOutput keeps
returning null and HashAggregation::needsInput() keeps returning false putting
Driver::runInternal into the infinite loop and hanging the query.

A fix is to not set partialFull_ to true if there are not new keys and wait for a batch
with new keys before flushing.

Fixes #7967

Copy link

netlify bot commented Dec 11, 2023

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit f2fb5c4
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/657748d0333b620008922883

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 11, 2023
@facebook-github-bot
Copy link
Contributor

@mbasmanova has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@xiaoxmeng xiaoxmeng left a comment

Choose a reason for hiding this comment

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

@mbasmanova LGTM. Thanks!

@facebook-github-bot
Copy link
Contributor

@mbasmanova merged this pull request in 5245e00.

Copy link

Conbench analyzed the 1 benchmark run on commit 5245e00c.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Partial distinct aggregation query hangs forever
4 participants