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 null value check for kRange frame column #11075

Closed

Conversation

pramodsatya
Copy link
Collaborator

The columns in WindowPartition::data_ are reordered to start with partition-by keys and order-by keys, whereas the columns in WindowPartition::columns_ are in the same order as the Window operator. The variable orderByColumn contains the index of order-by key in the reordered columns, so this should be accessed from data_ and not columns_. A unit test is added to ensure an exception is thrown when NULL values in order-by column and frame column do not match.

@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 Sep 23, 2024
Copy link

netlify bot commented Sep 23, 2024

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 0b9d3d3
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/66f2f3ca07900e0008f19cea

Copy link
Contributor

@kagamiori kagamiori left a comment

Choose a reason for hiding this comment

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

Hi @pramodsatya, thank you for the fix! It looks mostly good to me. I left a few comments.

velox/exec/tests/WindowTest.cpp Outdated Show resolved Hide resolved
velox/exec/tests/WindowTest.cpp Show resolved Hide resolved
velox/exec/WindowPartition.cpp Show resolved Hide resolved
Copy link
Collaborator Author

@pramodsatya pramodsatya left a comment

Choose a reason for hiding this comment

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

Thanks for the feedback @kagamiori, addressed the comments. Could you please take another look?

Copy link
Collaborator

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

Thanks @pramodsatya

velox/exec/WindowPartition.cpp Show resolved Hide resolved
velox/exec/WindowPartition.cpp Outdated Show resolved Hide resolved
velox/exec/tests/WindowTest.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator Author

@pramodsatya pramodsatya left a comment

Choose a reason for hiding this comment

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

Thanks for the feedback @aditi-pandit, addressed the comments. Could you please take another look?

velox/exec/WindowPartition.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@kagamiori kagamiori left a comment

Choose a reason for hiding this comment

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

LGTM, except one question about the DEBUG_ONLY test.

@@ -487,5 +487,41 @@ TEST_F(WindowTest, nagativeFrameArg) {
}
}

DEBUG_ONLY_TEST_F(WindowTest, frameColumnNullCheck) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious why we make it DEBUG_ONLY test?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@kagamiori : Because the assertion which crashed was a DCHECK. It didn't really participate in any logic which had correct offsets. If we had commented out the DCHECK, the code would've worked correctly.

I feel that code should retain as a DCHECK only. We don't anticipate it at runtime, but is an assumption about how things are setup.

@facebook-github-bot
Copy link
Contributor

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

Copy link
Collaborator

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

Thanks @pramodsatya

@facebook-github-bot
Copy link
Contributor

@kagamiori merged this pull request in 4da43a1.

@pramodsatya pramodsatya deleted the frame_col_null_chk branch September 26, 2024 22:06
Copy link

Conbench analyzed the 1 benchmark run on commit 4da43a13.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

athmaja-n pushed a commit to athmaja-n/velox that referenced this pull request Jan 10, 2025
Summary:
The columns in `WindowPartition::data_` are reordered to start with partition-by keys and order-by keys, whereas the columns in `WindowPartition::columns_` are in the same order as the Window operator. The variable `orderByColumn` contains the index of order-by key in the reordered columns, so this should be accessed from `data_` and not `columns_`. A unit test is added to ensure an exception is thrown when NULL values in order-by column and frame column do not match.

Pull Request resolved: facebookincubator#11075

Reviewed By: amitkdutta

Differential Revision: D63404094

Pulled By: kagamiori

fbshipit-source-id: cae3713c3c6c945001af8c2930ba08a34d574f67
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.

4 participants