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

Use DictionaryArray's iterator in compare_dict_op #1330

Merged
merged 1 commit into from
Feb 28, 2022

Conversation

viirya
Copy link
Member

@viirya viirya commented Feb 17, 2022

Which issue does this PR close?

Closes #1329.

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

@viirya viirya changed the title Use DictionaryArray's iterator Use DictionaryArray's iterator in compare_dict_op Feb 17, 2022
@github-actions github-actions bot added the arrow Changes to the arrow crate label Feb 17, 2022
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

The only potential concern I have here is that the take_iter()s use value() instead of value_unchecked() -- though perhaps we can merge this PR in and then add some additional unsafe / skipping bounds checking if it turns out to be in anyone's critical path / shows up in profiles

Thanks @viirya

let left_values = $left.values().as_any().downcast_ref::<$value_ty>().unwrap();
let right_values = $right

let left_iter = $left
Copy link
Contributor

Choose a reason for hiding this comment

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

This sure looks much nicer 👍

@viirya
Copy link
Member Author

viirya commented Feb 17, 2022

The only potential concern I have here is that the take_iter()s use value() instead of value_unchecked() -- though perhaps we can merge this PR in and then add some additional unsafe / skipping bounds checking if it turns out to be in anyone's critical path / shows up in profiles

Thanks @alamb . As we don't know if the keys in key iterator are fully in the valid range, seems we cannot skipping bounds check in take_iter? If it is critical, maybe we can have take_iter_unchecked in the future if it is necessary?

@alamb
Copy link
Contributor

alamb commented Feb 17, 2022

Thanks @alamb . As we don't know if the keys in key iterator are fully in the valid range,seems we cannot skipping bounds check in take_iter?

That is true in general. However, if we are iterating over a set of keys from a known valid DictionaryArray the indexes are known to be valid

If it is critical, maybe we can have take_iter_unchecked in the future if it is necessary?

I think this is wise strategy

@alamb
Copy link
Contributor

alamb commented Feb 28, 2022

I filed #1371 for follow on performance work and I am merging this one in now 🚀

thanks @viirya

@alamb alamb merged commit f58a8d9 into apache:master Feb 28, 2022
@viirya
Copy link
Member Author

viirya commented Feb 28, 2022

Thank you @alamb !

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.

Use DictionaryArray's iterator in compare_dict_op
2 participants