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

Fix make_column_from_scalar for all-null strings column #11807

Merged

Conversation

davidwendt
Copy link
Contributor

Description

Fixes the cudf::make_column_from_scalar for an invalid cudf::string_scalar to return a column with children. Some libcudf APIs will not work with a strings column with no children. This condition would be rare enough that additional logic for checking no children in these places would be a performance and maintenance issue.
This also greatly simplifies the make_column_from_scalar specialization logic for strings.

Closes #11756

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 bug Something isn't working 3 - Ready for Review Ready for review by team libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change labels Sep 28, 2022
@davidwendt davidwendt self-assigned this Sep 28, 2022
@davidwendt davidwendt requested a review from a team as a code owner September 28, 2022 18:46
@codecov
Copy link

codecov bot commented Sep 28, 2022

Codecov Report

Base: 87.40% // Head: 87.52% // Increases project coverage by +0.11% 🎉

Coverage data is based on head (b4ce285) compared to base (f72c4ce).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@               Coverage Diff                @@
##           branch-22.12   #11807      +/-   ##
================================================
+ Coverage         87.40%   87.52%   +0.11%     
================================================
  Files               133      133              
  Lines             21833    21807      -26     
================================================
+ Hits              19084    19086       +2     
+ Misses             2749     2721      -28     
Impacted Files Coverage Δ
python/cudf/cudf/core/udf/__init__.py 50.00% <ø> (ø)
python/cudf/cudf/utils/ioutils.py 79.47% <ø> (ø)
...thon/dask_cudf/dask_cudf/tests/test_distributed.py 18.86% <ø> (+4.94%) ⬆️
python/cudf/cudf/__init__.py 90.69% <100.00%> (ø)
python/cudf/cudf/core/scalar.py 90.52% <100.00%> (+1.25%) ⬆️
python/dask_cudf/dask_cudf/sorting.py 93.29% <100.00%> (+2.11%) ⬆️
python/strings_udf/strings_udf/__init__.py 96.87% <100.00%> (ø)
python/strings_udf/strings_udf/_typing.py 94.73% <0.00%> (-1.06%) ⬇️
python/cudf/cudf/testing/dataset_generator.py 72.83% <0.00%> (-0.42%) ⬇️
python/cudf/cudf/core/column/numerical.py 95.21% <0.00%> (-0.29%) ⬇️
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@PointKernel PointKernel left a comment

Choose a reason for hiding this comment

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

Is there a test exercising this fix?

@davidwendt
Copy link
Contributor Author

davidwendt commented Sep 28, 2022

Is there a test exercising this fix?

Yes. There are existing tests. Here are two of them:

TEST_F(ColumnFactoryTest, FromStringScalar)
{
cudf::string_scalar value("hello");
auto column = cudf::make_column_from_scalar(value, 1);
EXPECT_EQ(1, column->size());
EXPECT_EQ(column->type(), value.type());
EXPECT_EQ(0, column->null_count());
EXPECT_FALSE(column->nullable());
EXPECT_FALSE(column->has_nulls());
}
TEST_F(ColumnFactoryTest, FromNullStringScalar)
{
cudf::string_scalar value("", false);
auto column = cudf::make_column_from_scalar(value, 2);
EXPECT_EQ(2, column->size());
EXPECT_EQ(column->type(), value.type());
EXPECT_EQ(2, column->null_count());
EXPECT_TRUE(column->nullable());
EXPECT_TRUE(column->has_nulls());
}

Copy link
Member

@PointKernel PointKernel left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

cpp/src/column/column_factories.cu Outdated Show resolved Hide resolved
cpp/src/column/column_factories.cu Show resolved Hide resolved
@davidwendt davidwendt requested a review from bdice October 4, 2022 16:06
@davidwendt
Copy link
Contributor Author

@gpucibot merge

@rapids-bot rapids-bot bot merged commit e323f0a into rapidsai:branch-22.12 Oct 6, 2022
@davidwendt davidwendt deleted the bug-make-string-all-null branch October 6, 2022 19:55
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 bug Something isn't working libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

All null string column representation
3 participants