Skip to content

Commit

Permalink
Use cudf::make_empty_column instead of column_view constructor (#14030)
Browse files Browse the repository at this point in the history
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.

Authors:
  - David Wendt (https://github.com/davidwendt)

Approvers:
  - Vukasin Milovanovic (https://github.com/vuule)
  - Mike Wilson (https://github.com/hyperbolic2346)

URL: #14030
  • Loading branch information
davidwendt authored Sep 3, 2023
1 parent 0c829cc commit c516336
Show file tree
Hide file tree
Showing 26 changed files with 79 additions and 94 deletions.
2 changes: 1 addition & 1 deletion cpp/src/io/json/write_json.cu
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ struct column_to_strings_fn {
return cudf::strings::detail::from_timestamps(
column,
format,
strings_column_view(column_view{data_type{type_id::STRING}, 0, nullptr, nullptr, 0}),
strings_column_view(make_empty_column(type_id::STRING)->view()),
stream_,
mr_);
}
Expand Down
10 changes: 4 additions & 6 deletions cpp/tests/copying/gather_str_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,9 @@ TEST_F(GatherTestStr, GatherDontCheckOutOfBounds)

TEST_F(GatherTestStr, GatherEmptyMapStringsColumn)
{
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);
cudf::test::fixed_width_column_wrapper<cudf::size_type> gather_map;
auto results = cudf::detail::gather(cudf::table_view({zero_size_strings_column}),
auto results = cudf::detail::gather(cudf::table_view({zero_size_strings_column->view()}),
gather_map,
cudf::out_of_bounds_policy::NULLIFY,
cudf::detail::negative_index_policy::NOT_ALLOWED,
Expand All @@ -147,11 +146,10 @@ TEST_F(GatherTestStr, GatherEmptyMapStringsColumn)

TEST_F(GatherTestStr, GatherZeroSizeStringsColumn)
{
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);
cudf::test::fixed_width_column_wrapper<int32_t> gather_map({0});
cudf::test::strings_column_wrapper expected{std::pair<std::string, bool>{"", false}};
auto results = cudf::detail::gather(cudf::table_view({zero_size_strings_column}),
auto results = cudf::detail::gather(cudf::table_view({zero_size_strings_column->view()}),
gather_map,
cudf::out_of_bounds_policy::NULLIFY,
cudf::detail::negative_index_policy::NOT_ALLOWED,
Expand Down
2 changes: 1 addition & 1 deletion cpp/tests/reshape/interleave_columns_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ struct InterleaveStringsColumnsTest : public cudf::test::BaseFixture {};

TEST_F(InterleaveStringsColumnsTest, ZeroSizedColumns)
{
cudf::column_view col0(cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0);
auto const col0 = cudf::make_empty_column(cudf::type_id::STRING)->view();

auto results = cudf::interleave_columns(cudf::table_view{{col0}});
cudf::test::expect_column_empty(results->view());
Expand Down
18 changes: 9 additions & 9 deletions cpp/tests/strings/array_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

auto results = cudf::sort(cudf::table_view({zero_size_strings_column}));
cudf::test::expect_column_empty(results->view().column(0));
}
Expand Down Expand Up @@ -117,8 +117,8 @@ INSTANTIATE_TEST_CASE_P(StringsColumnTest,

TEST_F(StringsColumnTest, SliceZeroSizeStringsColumn)
{
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();

auto scol = cudf::slice(zero_size_strings_column, {0, 0});
auto results = std::make_unique<cudf::column>(scol.front());
cudf::test::expect_column_empty(results->view());
Expand All @@ -141,8 +141,8 @@ TEST_F(StringsColumnTest, Gather)

TEST_F(StringsColumnTest, GatherZeroSizeStringsColumn)
{
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();

cudf::column_view map_view(cudf::data_type{cudf::type_id::INT32}, 0, nullptr, nullptr, 0);
auto results = cudf::gather(cudf::table_view{{zero_size_strings_column}}, map_view)->release();
cudf::test::expect_column_empty(results.front()->view());
Expand Down Expand Up @@ -193,9 +193,9 @@ TEST_F(StringsColumnTest, ScatterScalar)

TEST_F(StringsColumnTest, ScatterZeroSizeStringsColumn)
{
cudf::column_view source(cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0);
cudf::column_view target(cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0);
cudf::column_view scatter_map(cudf::data_type{cudf::type_id::INT8}, 0, nullptr, nullptr, 0);
auto const source = cudf::make_empty_column(cudf::type_id::STRING)->view();
auto const target = cudf::make_empty_column(cudf::type_id::STRING)->view();
auto const scatter_map = cudf::make_empty_column(cudf::type_id::INT8)->view();

auto results = cudf::scatter(cudf::table_view({source}), scatter_map, cudf::table_view({target}));
cudf::test::expect_column_empty(results->view().column(0));
Expand Down
4 changes: 2 additions & 2 deletions cpp/tests/strings/attrs_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ TEST_F(StringsAttributesTest, CodePoints)

TEST_F(StringsAttributesTest, ZeroSizeStringsColumn)
{
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();

auto strings_view = cudf::strings_column_view(zero_size_strings_column);
cudf::column_view expected_column(cudf::data_type{cudf::type_id::INT32}, 0, nullptr, nullptr, 0);

Expand Down
9 changes: 4 additions & 5 deletions cpp/tests/strings/booleans_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,15 @@ TEST_F(StringsConvertTest, FromBooleans)

TEST_F(StringsConvertTest, ZeroSizeStringsColumnBoolean)
{
cudf::column_view zero_size_column(cudf::data_type{cudf::type_id::BOOL8}, 0, nullptr, nullptr, 0);
auto results = cudf::strings::from_booleans(zero_size_column);
auto const zero_size_column = cudf::make_empty_column(cudf::type_id::BOOL8)->view();
auto results = cudf::strings::from_booleans(zero_size_column);
cudf::test::expect_column_empty(results->view());
}

TEST_F(StringsConvertTest, ZeroSizeBooleansColumn)
{
cudf::column_view zero_size_column(
cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0);
auto results = cudf::strings::to_booleans(zero_size_column);
auto const zero_size_strings_column = cudf::make_empty_column(cudf::type_id::STRING)->view();
auto results = cudf::strings::to_booleans(zero_size_strings_column);
EXPECT_EQ(0, results->size());
}

Expand Down
4 changes: 2 additions & 2 deletions cpp/tests/strings/case_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ TEST_F(StringsCaseTest, LongStrings)

TEST_F(StringsCaseTest, EmptyStringsColumn)
{
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();

auto strings_view = cudf::strings_column_view(zero_size_strings_column);

auto results = cudf::strings::to_lower(strings_view);
Expand Down
12 changes: 5 additions & 7 deletions cpp/tests/strings/combine/concatenate_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ TEST_F(StringsCombineTest, ConcatenateSkipNulls)

TEST_F(StringsCombineTest, ConcatZeroSizeStringsColumns)
{
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();
std::vector<cudf::column_view> strings_columns;
strings_columns.push_back(zero_size_strings_column);
strings_columns.push_back(zero_size_strings_column);
Expand All @@ -161,8 +160,8 @@ TEST_F(StringsCombineTest, ConcatZeroSizeStringsColumns)

TEST_F(StringsCombineTest, SingleColumnErrorCheck)
{
cudf::column_view col0(cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0);
EXPECT_THROW(cudf::strings::concatenate(cudf::table_view{{col0}}), cudf::logic_error);
auto const col0 = cudf::make_empty_column(cudf::type_id::STRING);
EXPECT_THROW(cudf::strings::concatenate(cudf::table_view{{col0->view()}}), cudf::logic_error);
}

struct StringsConcatenateWithColSeparatorTest : public cudf::test::BaseFixture {};
Expand All @@ -180,7 +179,7 @@ TEST_F(StringsConcatenateWithColSeparatorTest, ExceptionTests)
}

{
cudf::column_view col0(cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0);
auto const col0 = cudf::make_empty_column(cudf::type_id::STRING)->view();
cudf::test::fixed_width_column_wrapper<int64_t> col1{{1}};

EXPECT_THROW(
Expand All @@ -200,8 +199,7 @@ TEST_F(StringsConcatenateWithColSeparatorTest, ExceptionTests)

TEST_F(StringsConcatenateWithColSeparatorTest, ZeroSizedColumns)
{
cudf::column_view col0(cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0);

auto const col0 = cudf::make_empty_column(cudf::type_id::STRING)->view();
auto results =
cudf::strings::concatenate(cudf::table_view{{col0}}, cudf::strings_column_view(col0));
cudf::test::expect_column_empty(results->view());
Expand Down
4 changes: 2 additions & 2 deletions cpp/tests/strings/combine/join_strings_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ TEST_F(JoinStringsTest, JoinLongStrings)

TEST_F(JoinStringsTest, JoinZeroSizeStringsColumn)
{
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();

auto strings_view = cudf::strings_column_view(zero_size_strings_column);
auto results = cudf::strings::join_strings(strings_view);
cudf::test::expect_column_empty(results->view());
Expand Down
10 changes: 4 additions & 6 deletions cpp/tests/strings/concatenate_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ TEST_F(StringsConcatenateTest, Concatenate)
cudf::test::strings_column_wrapper strings2(h_strings.data() + 6, h_strings.data() + 10);
cudf::test::strings_column_wrapper strings3(h_strings.data() + 10,
h_strings.data() + h_strings.size());
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();

std::vector<cudf::column_view> strings_columns;
strings_columns.push_back(strings1);
Expand All @@ -67,8 +67,7 @@ TEST_F(StringsConcatenateTest, Concatenate)

TEST_F(StringsConcatenateTest, ZeroSizeStringsColumns)
{
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();
std::vector<cudf::column_view> strings_columns;
strings_columns.push_back(zero_size_strings_column);
strings_columns.push_back(zero_size_strings_column);
Expand All @@ -79,8 +78,7 @@ TEST_F(StringsConcatenateTest, ZeroSizeStringsColumns)

TEST_F(StringsConcatenateTest, ZeroSizeStringsPlusNormal)
{
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();
std::vector<cudf::column_view> strings_columns;
strings_columns.push_back(zero_size_strings_column);

Expand Down
8 changes: 3 additions & 5 deletions cpp/tests/strings/datetime_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,13 +605,11 @@ TEST_F(StringsDatetimeTest, FromTimestampAllSpecifiers)

TEST_F(StringsDatetimeTest, ZeroSizeStringsColumn)
{
cudf::column_view zero_size_column(
cudf::data_type{cudf::type_id::TIMESTAMP_SECONDS}, 0, nullptr, nullptr, 0);
auto results = cudf::strings::from_timestamps(zero_size_column);
auto const zero_size_column = cudf::make_empty_column(cudf::type_id::TIMESTAMP_SECONDS)->view();
auto results = cudf::strings::from_timestamps(zero_size_column);
cudf::test::expect_column_empty(results->view());

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();
results = cudf::strings::to_timestamps(cudf::strings_column_view(zero_size_strings_column),
cudf::data_type{cudf::type_id::TIMESTAMP_SECONDS},
"%Y");
Expand Down
8 changes: 3 additions & 5 deletions cpp/tests/strings/durations_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -728,13 +728,11 @@ TEST_F(StringsDurationsTest, ParseEscapeCharacters)

TEST_F(StringsDurationsTest, ZeroSizeStringsColumn)
{
cudf::column_view zero_size_column(
cudf::data_type{cudf::type_id::DURATION_SECONDS}, 0, nullptr, nullptr, 0);
auto results = cudf::strings::from_durations(zero_size_column);
auto const zero_size_column = cudf::make_empty_column(cudf::type_id::DURATION_SECONDS)->view();
auto results = cudf::strings::from_durations(zero_size_column);
cudf::test::expect_column_empty(results->view());

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();
results = cudf::strings::to_durations(cudf::strings_column_view(zero_size_strings_column),
cudf::data_type{cudf::type_id::DURATION_SECONDS},
"%S");
Expand Down
3 changes: 1 addition & 2 deletions cpp/tests/strings/fill_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ TEST_F(StringsFillTest, Fill)

TEST_F(StringsFillTest, ZeroSizeStringsColumns)
{
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();
auto results = cudf::fill(zero_size_strings_column, 0, 0, cudf::string_scalar(""));
cudf::test::expect_column_empty(results->view());
}
Expand Down
10 changes: 4 additions & 6 deletions cpp/tests/strings/find_multiple_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ TEST_F(StringsFindMultipleTest, FindMultiple)

TEST_F(StringsFindMultipleTest, ZeroSizeStringsColumn)
{
cudf::column_view zero_size_strings_column(
cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0);
auto strings_view = cudf::strings_column_view(zero_size_strings_column);
auto const zero_size_strings_column = cudf::make_empty_column(cudf::type_id::STRING)->view();
auto strings_view = cudf::strings_column_view(zero_size_strings_column);
std::vector<char const*> h_targets{""};
cudf::test::strings_column_wrapper targets(h_targets.begin(), h_targets.end());
auto targets_view = cudf::strings_column_view(targets);
Expand All @@ -73,9 +72,8 @@ TEST_F(StringsFindMultipleTest, ErrorTest)
cudf::test::strings_column_wrapper strings({"this string intentionally left blank"}, {0});
auto strings_view = cudf::strings_column_view(strings);

cudf::column_view zero_size_strings_column(
cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0);
auto empty_view = cudf::strings_column_view(zero_size_strings_column);
auto const zero_size_strings_column = cudf::make_empty_column(cudf::type_id::STRING)->view();
auto empty_view = cudf::strings_column_view(zero_size_strings_column);
// targets must have at least one string
EXPECT_THROW(cudf::strings::find_multiple(strings_view, empty_view), cudf::logic_error);

Expand Down
7 changes: 3 additions & 4 deletions cpp/tests/strings/find_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,9 @@ TEST_F(StringsFindTest, EndsWith)

TEST_F(StringsFindTest, ZeroSizeStringsColumn)
{
cudf::column_view zero_size_strings_column(
cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0);
auto strings_view = cudf::strings_column_view(zero_size_strings_column);
auto results = cudf::strings::find(strings_view, cudf::string_scalar("é"));
auto const zero_size_strings_column = cudf::make_empty_column(cudf::type_id::STRING)->view();
auto strings_view = cudf::strings_column_view(zero_size_strings_column);
auto results = cudf::strings::find(strings_view, cudf::string_scalar("é"));
EXPECT_EQ(results->size(), 0);
results = cudf::strings::rfind(strings_view, cudf::string_scalar("é"));
EXPECT_EQ(results->size(), 0);
Expand Down
9 changes: 4 additions & 5 deletions cpp/tests/strings/integers_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,17 +261,16 @@ TEST_F(StringsConvertTest, FromInteger)

TEST_F(StringsConvertTest, ZeroSizeStringsColumn)
{
cudf::column_view zero_size_column(cudf::data_type{cudf::type_id::INT32}, 0, nullptr, nullptr, 0);
auto results = cudf::strings::from_integers(zero_size_column);
auto const zero_size_column = cudf::make_empty_column(cudf::type_id::INT32)->view();
auto results = cudf::strings::from_integers(zero_size_column);
cudf::test::expect_column_empty(results->view());
}

TEST_F(StringsConvertTest, ZeroSizeIntegersColumn)
{
cudf::column_view zero_size_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();
auto results =
cudf::strings::to_integers(zero_size_column, cudf::data_type{cudf::type_id::INT32});
cudf::strings::to_integers(zero_size_strings_column, cudf::data_type{cudf::type_id::INT32});
EXPECT_EQ(0, results->size());
}

Expand Down
3 changes: 2 additions & 1 deletion cpp/tests/strings/ipv4_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ TEST_F(StringsConvertTest, IntegersToIPv4)

TEST_F(StringsConvertTest, ZeroSizeStringsColumnIPV4)
{
cudf::column_view zero_size_column(cudf::data_type{cudf::type_id::INT64}, 0, nullptr, nullptr, 0);
auto const zero_size_column = cudf::make_empty_column(cudf::type_id::INT64)->view();

auto results = cudf::strings::integers_to_ipv4(zero_size_column);
cudf::test::expect_column_empty(results->view());
results = cudf::strings::ipv4_to_integers(results->view());
Expand Down
4 changes: 2 additions & 2 deletions cpp/tests/strings/pad_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ TEST_F(StringsPadTest, PaddingBoth)

TEST_F(StringsPadTest, ZeroSizeStringsColumn)
{
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();

auto strings_view = cudf::strings_column_view(zero_size_strings_column);
auto results = cudf::strings::pad(strings_view, 5);
cudf::test::expect_column_empty(results->view());
Expand Down
4 changes: 2 additions & 2 deletions cpp/tests/strings/replace_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,8 @@ TEST_F(StringsReplaceTest, ReplaceMultiLong)

TEST_F(StringsReplaceTest, EmptyStringsColumn)
{
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();

auto strings_view = cudf::strings_column_view(zero_size_strings_column);
auto results = cudf::strings::replace(
strings_view, cudf::string_scalar("not"), cudf::string_scalar("pertinent"));
Expand Down
4 changes: 2 additions & 2 deletions cpp/tests/strings/reverse_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ TEST_F(StringsReverseTest, Reverse)

TEST_F(StringsReverseTest, EmptyStringsColumn)
{
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();

auto results = cudf::strings::reverse(cudf::strings_column_view(zero_size_strings_column));
auto view = results->view();
cudf::test::expect_column_empty(results->view());
Expand Down
10 changes: 5 additions & 5 deletions cpp/tests/strings/slice_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,15 @@ TEST_F(StringsSliceTest, Error)

TEST_F(StringsSliceTest, ZeroSizeStringsColumn)
{
cudf::column_view zero_size_strings_column(
cudf::data_type{cudf::type_id::STRING}, 0, nullptr, nullptr, 0);
auto strings_view = cudf::strings_column_view(zero_size_strings_column);
auto const zero_size_strings_column = cudf::make_empty_column(cudf::type_id::STRING)->view();
auto strings_view = cudf::strings_column_view(zero_size_strings_column);

auto results = cudf::strings::slice_strings(strings_view, 1, 2);
cudf::test::expect_column_empty(results->view());

cudf::column_view starts_column(cudf::data_type{cudf::type_id::INT32}, 0, nullptr, nullptr, 0);
cudf::column_view stops_column(cudf::data_type{cudf::type_id::INT32}, 0, nullptr, nullptr, 0);
auto const starts_column = cudf::make_empty_column(cudf::type_id::INT32)->view();
auto const stops_column = cudf::make_empty_column(cudf::type_id::INT32)->view();

results = cudf::strings::slice_strings(strings_view, starts_column, stops_column);
cudf::test::expect_column_empty(results->view());
}
Expand Down
Loading

0 comments on commit c516336

Please sign in to comment.