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 operator precedence problem in Parquet reader #15638

Merged
merged 1 commit into from
May 2, 2024

Conversation

etseidl
Copy link
Contributor

@etseidl etseidl commented May 2, 2024

Description

Fixes an operator precedence problem with a bitwise & that was not detected because it was accidentally correct. PAGEINFO_FLAGS_DICTIONARY has a value of '1', so PAGEINFO_FLAGS_DICTIONARY != 0 evaluates to '1', and that ANDed with the page flags evaluates true when the bit is set.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@etseidl etseidl requested a review from a team as a code owner May 2, 2024 18:42
@etseidl etseidl requested review from harrism and ttnghia May 2, 2024 18:42
Copy link

copy-pr-bot bot commented May 2, 2024

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions bot added the libcudf Affects libcudf (C++/CUDA) code. label May 2, 2024
@etseidl etseidl changed the title fix operator precedence problem Fix operator precedence problem in Parquet reader May 2, 2024
@davidwendt davidwendt added bug Something isn't working 3 - Ready for Review Ready for review by team non-breaking Non-breaking change labels May 2, 2024
@davidwendt
Copy link
Contributor

/ok to test

Copy link
Contributor

@ttnghia ttnghia 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 fixing it. This is the reason why I always prefer to use parentheses whenever possible.

@ttnghia
Copy link
Contributor

ttnghia commented May 2, 2024

/merge

@etseidl
Copy link
Contributor Author

etseidl commented May 2, 2024

This is the reason why I always prefer to use parentheses whenever possible.

Yes. My guess is this was an attempt to clean up a if (flag&ENUM) that went horribly wrong.

@@ -122,7 +122,7 @@ struct null_count_back_copier {
*/
constexpr bool is_string_col(PageInfo const& page, device_span<ColumnChunkDesc const> chunks)
{
if (page.flags & PAGEINFO_FLAGS_DICTIONARY != 0) { return false; }
if ((page.flags & PAGEINFO_FLAGS_DICTIONARY) != 0) { return false; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Or just this:

Suggested change
if ((page.flags & PAGEINFO_FLAGS_DICTIONARY) != 0) { return false; }
if (page.flags & PAGEINFO_FLAGS_DICTIONARY) { return false; }

Copy link
Contributor

Choose a reason for hiding this comment

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

but that's implicit conversion and I don't like that :)

@rapids-bot rapids-bot bot merged commit 541b53a into rapidsai:branch-24.06 May 2, 2024
69 checks passed
@etseidl etseidl deleted the is_strcol_fix branch May 2, 2024 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for Review Ready for review by team bug Something isn't working libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants