Two-table comparators with strong index types#10730
Two-table comparators with strong index types#10730rapids-bot[bot] merged 35 commits intorapidsai:branch-22.06from
Conversation
|
FYI, here is my simple version of |
This comment was marked as off-topic.
This comment was marked as off-topic.
| __device__ bool operator()(lhs_index_type const lhs_index, | ||
| rhs_index_type const rhs_index) const noexcept |
There was a problem hiding this comment.
I think we'll need overloads for (lhs_index_type, lhs_index_type) and (rhs_index_type, rhs_index_type) as well.
There was a problem hiding this comment.
Possible — but I haven’t found an algorithm that needs those yet. For example, merge requires sorted inputs, so the lhs/lhs and rhs/rhs overloads are never needed.
There was a problem hiding this comment.
Also, overloads for (lhs_index_type, lhs_index_type) and (rhs_index_type, rhs_index_type) would require this class to own two additional comparators (self comparators for left and right tables).
There was a problem hiding this comment.
Hey guys! I stumbled on to this: using self_comparator with strong index types! So we are going to need (lhs_index_type, lhs_index_type) and (rhs_index_type, rhs_index_type) overloads for self_comparator.
These overloads just convert lhs_index_type or lhs_index_type into size_type and call the normal operator()(size_type).
Update: I may not need this as I have another idea to avoid using strong index type, but this is still a relevant need.
|
It seems that we must rely on the upcoming weak order comparator from #10793. |
ttnghia
left a comment
There was a problem hiding this comment.
Approve, pending CI tests to pass all 😃
jrhemstad
left a comment
There was a problem hiding this comment.
Very clean and concise PR!
|
@gpucibot merge |
| template <typename Index, typename Underlying = std::underlying_type_t<Index>> | ||
| struct strong_index_iterator : public thrust::iterator_facade<strong_index_iterator<Index>, |
There was a problem hiding this comment.
@bdice I realize that I am late to the party here, but this struct has zero docs. A new reader of the code won't have any idea why this struct exists since the purpose is not conveyed by its implementation, but rather by its existence alone. Could you make a PR with some brief documentation (or maybe just stick that into one of the downstream PRs that either you or @ttnghia is working on)?
There was a problem hiding this comment.
Sure thing. I can create a standalone PR for this.
This adds strong index types for equality comparator, along with #10730 to unblock #10548, #10656, and several others nested type feature requests. Authors: - Nghia Truong (https://github.com/ttnghia) - Bradley Dice (https://github.com/bdice) Approvers: - AJ Schmidt (https://github.com/ajschmidt8) - Bradley Dice (https://github.com/bdice) URL: #10883
This extends the `cudf::contains` API to support nested types (lists + structs) with arbitrarily nested levels. As such, `cudf::contains` will work with literally any type of input data. In addition, this fixes null handling of `cudf::contains` with structs column + struct scalar input when the structs column contains null rows at the top level while the scalar key is valid but all nulls at children levels. Closes: #8965 Depends on: * #10730 * #10883 * #10802 * #10997 * NVIDIA/cuCollections#172 * NVIDIA/cuCollections#173 * #11037 * #11356 Authors: - Nghia Truong (https://github.com/ttnghia) - Devavret Makkar (https://github.com/devavret) - Bradley Dice (https://github.com/bdice) - Karthikeyan (https://github.com/karthikeyann) Approvers: - AJ Schmidt (https://github.com/ajschmidt8) - Bradley Dice (https://github.com/bdice) - Yunsong Wang (https://github.com/PointKernel) URL: #10656
This extends the `lists::contains` API to support nested types (lists + structs) with arbitrarily nested levels. As such, `lists::contains` will work with literally any type of input data. In addition, the related implementation has been significantly refactored to facilitate adding new implementation. Closes #8958. Depends on: * #10730 * #10883 * #10999 * #11019 * #11037 Authors: - Nghia Truong (https://github.com/ttnghia) - Bradley Dice (https://github.com/bdice) Approvers: - MithunR (https://github.com/mythrocks) - Bradley Dice (https://github.com/bdice) URL: #10548
This PR resolves #10508. It introduces two-table lexicographic row comparators with strongly typed index types. Given tables
lhsandrhs, thetwo_table_comparatorcan create a device comparator whose strongly typed call operator can compare bidirectionally:lhs[i] < rhs[j]andrhs[i] < lhs[j]. The strong typing indicates which index belongs to which table.This PR also contains a sample implementation in
search_ordered.cu, which implementslower_boundandupper_boundalgorithms.