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 bug in initializing global aggregations with initialized flag #9396

Closed

Conversation

kevinwilfong
Copy link
Contributor

Summary:
#9067 introduced an initialized flag that we include alongside the null flag
for aggregations in the rows in RowContainer.

Global aggregations do not use a RowContainer to create rows, rather a single row is constructed manually inside
GroupingSets. When that PR was landed this logic was not properly updated, we did not allocate enough space in the row
for the additional bits which could lead to null/initialized flags overwriting the aggregate values when there were a lot of
them.

This change fixes it so that we allocate the correct amount of space for flags for global aggregations as an immediate fix.

Longer term it would be better to centralize the logic for creating rows in RowContainer (I'd like to get us back to a working
state before attempting such a refactor).

Differential Revision: D55823098

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55823098

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported labels Apr 5, 2024
Copy link

netlify bot commented Apr 5, 2024

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 2f53976
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/66107ba31901b50008f1fd79

kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Apr 5, 2024
…cebookincubator#9396)

Summary:

facebookincubator#9067 introduced an initialized flag that we include alongside the null flag
for aggregations in the rows in RowContainer.

Global aggregations do not use a RowContainer to create rows, rather a single row is constructed manually inside 
GroupingSets.  When that PR was landed this logic was not properly updated, we did not allocate enough space in the row
for the additional bits which could lead to null/initialized flags overwriting the aggregate values when there were a lot of 
them.

This change fixes it so that we allocate the correct amount of space for flags for global aggregations as an immediate fix.

Longer term it would be better to centralize the logic for creating rows in RowContainer (I'd like to get us back to a working
state before attempting such a refactor).

Differential Revision: D55823098
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55823098

kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Apr 5, 2024
…cebookincubator#9396)

Summary:

facebookincubator#9067 introduced an initialized flag that we include alongside the null flag
for aggregations in the rows in RowContainer.

Global aggregations do not use a RowContainer to create rows, rather a single row is constructed manually inside 
GroupingSets.  When that PR was landed this logic was not properly updated, we did not allocate enough space in the row
for the additional bits which could lead to null/initialized flags overwriting the aggregate values when there were a lot of 
them.

This change fixes it so that we allocate the correct amount of space for flags for global aggregations as an immediate fix.

Longer term it would be better to centralize the logic for creating rows in RowContainer (I'd like to get us back to a working
state before attempting such a refactor).

Differential Revision: D55823098
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55823098

…cebookincubator#9396)

Summary:

facebookincubator#9067 introduced an initialized flag that we include alongside the null flag
for aggregations in the rows in RowContainer.

Global aggregations do not use a RowContainer to create rows, rather a single row is constructed manually inside 
GroupingSets.  When that PR was landed this logic was not properly updated, we did not allocate enough space in the row
for the additional bits which could lead to null/initialized flags overwriting the aggregate values when there were a lot of 
them.

This change fixes it so that we allocate the correct amount of space for flags for global aggregations as an immediate fix.

Longer term it would be better to centralize the logic for creating rows in RowContainer (I'd like to get us back to a working
state before attempting such a refactor).

Differential Revision: D55823098
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55823098

Copy link

Conbench analyzed the 1 benchmark run on commit e0ef5a26.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in e0ef5a2.


// Allocate space for the null and initialized flags.
int32_t rowSizeOffset =
bits::nbytes(aggregates_.size() * RowContainer::kNumAccumulatorFlags);
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @kevinwilfong , seems the flags don't consider for sortedAggregations_ and distinctAggregations_? cc @Yuhta @mbasmanova

Joe-Abraham pushed a commit to Joe-Abraham/velox that referenced this pull request Jun 7, 2024
…cebookincubator#9396)

Summary:
Pull Request resolved: facebookincubator#9396

facebookincubator#9067 introduced an initialized flag that we include alongside the null flag
for aggregations in the rows in RowContainer.

Global aggregations do not use a RowContainer to create rows, rather a single row is constructed manually inside
GroupingSets.  When that PR was landed this logic was not properly updated, we did not allocate enough space in the row
for the additional bits which could lead to null/initialized flags overwriting the aggregate values when there were a lot of
them.

This change fixes it so that we allocate the correct amount of space for flags for global aggregations as an immediate fix.

Longer term it would be better to centralize the logic for creating rows in RowContainer (I'd like to get us back to a working
state before attempting such a refactor).

Reviewed By: Yuhta

Differential Revision: D55823098

fbshipit-source-id: 9a15f257669273c64dc0361bf735c4472e45957d
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. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants