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

Refactor tests/iterator_utilities.hpp functions #8540

Merged
merged 4 commits into from
Jun 17, 2021

Conversation

ttnghia
Copy link
Contributor

@ttnghia ttnghia commented Jun 17, 2021

This PR refactors the functions in tests/iterator_utilities.hpp. In particular:

  • Put the functions into a namespace iterators
  • Remove the prefix iterator_with_ from the function names. As such, instead of having cudf::test::iterators_with_null_at (and similar cudf::test::iterators_with_*), we will have cudf::test::iterators::null_at (and similar). Upon usage, we can import the namespace cudf::test::iterators and use just null_at().

This refactor will make the test code look significantly cleaner. The subnamespace iterators makes sure that there will be no name conflict.

@ttnghia ttnghia added feature request New feature or request 3 - Ready for Review Ready for review by team tests Unit testing for project libcudf blocker libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change labels Jun 17, 2021
@ttnghia ttnghia self-assigned this Jun 17, 2021
@ttnghia ttnghia requested a review from a team as a code owner June 17, 2021 01:21
@codecov
Copy link

codecov bot commented Jun 17, 2021

Codecov Report

❗ No coverage uploaded for pull request base (branch-21.08@716dc12). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@               Coverage Diff               @@
##             branch-21.08    #8540   +/-   ##
===============================================
  Coverage                ?   82.96%           
===============================================
  Files                   ?      109           
  Lines                   ?    18197           
  Branches                ?        0           
===============================================
  Hits                    ?    15097           
  Misses                  ?     3100           
  Partials                ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 716dc12...9148a7b. Read the comment docs.

@@ -77,9 +75,9 @@ template <typename Iter>
* @param indices The indices for which the validity iterator must return `false` (i.e. null)
* @return auto Validity iterator
*/
[[maybe_unused]] static auto iterator_with_null_at(cudf::host_span<cudf::size_type const> indices)
[[maybe_unused]] static auto nulls_at(std::vector<cudf::size_type> const& indices)
Copy link
Contributor

@mythrocks mythrocks Jun 17, 2021

Choose a reason for hiding this comment

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

When I first wrote it, this API used to take a std::vector. The suggestion at the time was that host_spans are preferable.

I agree with your current change. (Personally, I prefer this be vector<> so that call sites don't have to explicitly construct vectors.) I hope this is agreeable with @harrism and/or @vuule.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, with host_span parameter, you cannot call nulls_at({1, 2, 3}). You must call nulls_at(std::vector<int>{1, 2, 3}). This is so much inconvenient.

Copy link
Contributor

@mythrocks mythrocks left a comment

Choose a reason for hiding this comment

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

I'm 👍.
We should specifically check that the change from cudf::host_span back to std::vector is agreeable to @harrism and/or @vuule.

@mythrocks
Copy link
Contributor

Ah, I missed that @harrism has already approved this PR. I think we might be good to go.

@ttnghia
Copy link
Contributor Author

ttnghia commented Jun 17, 2021

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 8fb1c42 into rapidsai:branch-21.08 Jun 17, 2021
@ttnghia ttnghia deleted the refactor_iterator_utilities branch June 23, 2021 13:43
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 feature request New feature or request libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change tests Unit testing for project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants