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 merge_dictionary_values in selection kernels #4833

Merged
merged 2 commits into from
Sep 19, 2023

Conversation

tustvold
Copy link
Contributor

@tustvold tustvold commented Sep 18, 2023

Which issue does this PR close?

Closes #.

Rationale for this change

Added in #3558 this had a subtle bug in the way it was computing the values masks

Found by apache/datafusion#7587

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added the arrow Changes to the arrow crate label Sep 18, 2023
) -> BooleanBuffer {
let mut builder = BooleanBufferBuilder::new(keys.len());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the bug, the length of the values_mask should match that of the values array not the keys. In all of the existing tests the number of keys outnumbered the number of values, not helped by the heuristic to trigger merging being based off the total number of keys outnumbering the total number of values.

@@ -330,4 +333,15 @@ mod tests {
assert_eq!(&merged.key_mappings[0], &[0, 0, 0, 1, 0]);
assert_eq!(&merged.key_mappings[1], &[]);
}

#[test]
Copy link
Contributor

Choose a reason for hiding this comment

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

I verified that without the changes in this PR this test fails like this:

thread 'dictionary::tests::test_merge_keys_smaller' panicked at 'assertion failed: `(left == right)`
  left: `StringArray
[
]`,
 right: `StringArray
[
  "b",
]`', arrow-select/src/dictionary.rs:342:9

@tustvold tustvold merged commit f7464bc into apache:master Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants