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 cudf::make_empty_column instead of column_view constructor #14030

Merged
merged 1 commit into from
Sep 3, 2023

Conversation

davidwendt
Copy link
Contributor

Description

Replaces places where the cudf::column_view(type,size,...) constructor was used to create an empty view with a call to cudf::make_column_view(type)->view().

This helps minimize the dependency on calling the constructors directly as part of the work needed for #13733 which may require an update to the column_view classes and its constructor(s).

Most of the changes occur in strings gtests source files.
No functionality or behavior has changed.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@davidwendt davidwendt added 3 - Ready for Review Ready for review by team libcudf Affects libcudf (C++/CUDA) code. improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Sep 1, 2023
@davidwendt davidwendt requested a review from a team as a code owner September 1, 2023 17:38
@davidwendt davidwendt self-assigned this Sep 1, 2023
@@ -47,8 +47,8 @@ TEST_F(StringsColumnTest, Sort)

TEST_F(StringsColumnTest, SortZeroSizeStringsColumn)
{
cudf::column_view zero_size_strings_column(
cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0);
auto const zero_size_strings_column = cudf::make_empty_column(cudf::type_id::STRING)->view();
Copy link
Contributor

@vuule vuule Sep 1, 2023

Choose a reason for hiding this comment

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

is this safe? we're keeping a view of a column that's a temporary object. The pattern in gather_str_tests.cpp looks more intuitive to me.

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 indeed safe. The return column_view contains no data. It has member data like type, etc. But the size and other values are set to null/zero. So there is no dependency on the column it came from.

@vuule
Copy link
Contributor

vuule commented Sep 3, 2023

/merge

@rapids-bot rapids-bot bot merged commit c516336 into rapidsai:branch-23.10 Sep 3, 2023
@davidwendt davidwendt deleted the use-make-empty branch September 5, 2023 14:17
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 improvement Improvement / enhancement to an existing function libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants