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: Fix optimization of re-using inputVector #12332

Closed

Conversation

yuandagits
Copy link
Contributor

Summary:
D69567930 introduced an optimization to reuse the inputVector to save cycles and likely memory when extracting data from a group.

However, there is a subtle bug here when we call extractSingleGroup(), it can return 0 rows. In this case, we must still update the firstInputColumn, which is a rolling index that represents which inputVectors map to which aggregateInputs.

By not updating this, we may get a mismatch in the reused inputVector and the actual underlying type at this particular column. This is a hidden bug that surfaces if the following conditions are at least satisfied:

  1. We've extracted a group with 0 rows
  2. We've retried to use an index at a position which has a type that is different that the column index.

Differential Revision: D69625562

Summary:
D69567930 introduced an optimization to reuse the inputVector to save cycles and likely memory when extracting data from a group.

However, there is a subtle bug here when we call `extractSingleGroup()`, it can return 0 rows. In this case, we must still update the firstInputColumn, which is a rolling index that represents which inputVectors map to which aggregateInputs.

By not updating this, we may get a mismatch in the reused inputVector and the actual underlying type at this particular column. This is a hidden bug that surfaces if the following conditions are at least satisfied:

1. We've extracted a group with 0 rows
2. We've retried to use an index at a position which has a type that is different that the column index.

Differential Revision: D69625562
@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 Feb 14, 2025
@facebook-github-bot
Copy link
Contributor

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

Copy link

netlify bot commented Feb 14, 2025

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit d933755
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/67aeaa1feeb1a0000809b99d

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 1f12637.

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.

3 participants