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 inconsistency when hashing two tables in cudf::detail::contains #11284

Merged
merged 3 commits into from
Jul 18, 2022

Conversation

ttnghia
Copy link
Contributor

@ttnghia ttnghia commented Jul 16, 2022

When hashing elements in a column, the nullable information needs to be taken into account. This could produce different results for the hash values of the same elements if the nullable condition is changed. As such, whenever we need to compute hashing for more than one column/table in the same operation, we need to take into account the nullable of all columns/tables, not just the one that is being hashed.

This PR fixes a bug when hashing two tables using different nullable values in cudf::detail::contains, which led to incorrect results when there is only one nullable table in the input.

@ttnghia ttnghia added bug Something isn't working 3 - Ready for Review Ready for review by team libcudf Affects libcudf (C++/CUDA) code. Spark Functionality that helps Spark RAPIDS non-breaking Non-breaking change labels Jul 16, 2022
@ttnghia ttnghia self-assigned this Jul 16, 2022
@ttnghia ttnghia requested a review from a team as a code owner July 16, 2022 22:16
@codecov

This comment was marked as off-topic.

Copy link
Contributor

@bdice bdice left a comment

Choose a reason for hiding this comment

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

This fix looks good - it makes sense and I wish I'd caught this in my initial review. :) @ttnghia Would you be able to write a test that catches this? (I see it was caught by Spark integration tests but I'd like a test in libcudf.)

@ttnghia
Copy link
Contributor Author

ttnghia commented Jul 17, 2022

This fix looks good - it makes sense and I wish I'd caught this in my initial review. :) @ttnghia Would you be able to write a test that catches this? (I see it was caught by Spark integration tests but I'd like a test in libcudf.)

Yeah the bug seems caused by a not very intuitive reason.
I have added a test for this particular case. It failed with the previous implementation and only passed with this fix.

@pxLi
Copy link
Member

pxLi commented Jul 18, 2022

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 5f9da83 into rapidsai:branch-22.08 Jul 18, 2022
@davidwendt
Copy link
Contributor

@pxLi Please don't merge C++ PRs unless they have at least 2 approvals.

@ttnghia ttnghia deleted the fix_hashing branch July 18, 2022 13:02
@pxLi
Copy link
Member

pxLi commented Jul 19, 2022

@pxLi Please don't merge C++ PRs unless they have at least 2 approvals.

sry my bad, I did not realize this rule. I will take it in mind in the future~

rapids-bot bot pushed a commit that referenced this pull request Apr 13, 2023
This is very similar to #11284, which fixes a bug when only one input table has nulls while the other doesn't. This is due to the new experimental hasher producing different hash values depending on an input flag `has_nulls`. In order to properly use it, `has_nulls` must be computed by checking all the possible input tables, or set to a constant value (`true`).

Closes:
 * #13109

Authors:
  - Nghia Truong (https://github.com/ttnghia)
  - Vyas Ramasubramani (https://github.com/vyasr)

Approvers:
  - Divye Gala (https://github.com/divyegala)
  - Yunsong Wang (https://github.com/PointKernel)

URL: #13120
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 Spark Functionality that helps Spark RAPIDS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants