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

[FEA] Add left and right index iterators for row_operators #3257

Closed
trevorsm7 opened this issue Oct 31, 2019 · 5 comments
Closed

[FEA] Add left and right index iterators for row_operators #3257

trevorsm7 opened this issue Oct 31, 2019 · 5 comments
Assignees
Labels
feature request New feature or request libcudf Affects libcudf (C++/CUDA) code.

Comments

@trevorsm7
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Issue #3207 fixed row_lexicographic_comparator when the left and right are not views into the same table. However, there is still an issue with disambiguation between indices into the left table and indices into the right table. For example, rator with the ordered sequence on the left and the values sequence on the right, but thrust::upper_bound uses the operator with the values sequence on the left and the ordered sequence on the right. It is very easy to initialize the comparator with the table views in the wrong order and there is no feedback at compile time if it is wrong.

Describe the solution you'd like
Add counting iterators with a strong typedef index type (similar to those in wrapper_types.hpp), such that the comparator operator() can be overloaded to disambiguate between (left_index, right_index) and (right_index, left_index). A same_index type could also be added to support cases where left and right are the same table and there is a single iterator, such as thrust::sort. Additionally, it might make sense to rename left/right or lhs/rhs to first/second to make it more clear that first may not always be left.

@trevorsm7 trevorsm7 added feature request New feature or request Needs Triage Need team to review and classify labels Oct 31, 2019
@trevorsm7 trevorsm7 self-assigned this Oct 31, 2019
@trevorsm7
Copy link
Contributor Author

@kkraus14 kkraus14 removed the Needs Triage Need team to review and classify label Dec 6, 2019
@trevorsm7
Copy link
Contributor Author

An alternative approach is the tagged_element_relational_comparator from PR #3250

@harrism
Copy link
Member

harrism commented Feb 10, 2020

@trevorsm7 can you comment on whether this is still a problem and important to fix?

@harrism harrism added the libcudf Affects libcudf (C++/CUDA) code. label Feb 10, 2020
@trevorsm7
Copy link
Contributor Author

I think this is still an issue that should be fixed. It's easy for row_lexicographic_comparator to mix up the lhs and rhs indices when the left and right tables are different, because some thrust algorithms use operator(rhs, lhs) to check if lhs > rhs instead of lhs < rhs. The strong typedef solution proposed above should only take a few days to implement.

The row_lexicographic_tagged_comparator functor was also added to serve a similar purpose for thrust::merge (which has a special requirement that the lhs and rhs indices be the same type, so enum tags had to be used rather than strong typedefs). This currently lives in merge.cuh, but it might be a good idea to move this to row_operators.cuh so it's grouped with related functions.

@jrhemstad
Copy link
Contributor

Closing this in favor of #10508

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request libcudf Affects libcudf (C++/CUDA) code.
Projects
None yet
Development

No branches or pull requests

4 participants