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

Replace default stream for scalars and column factories usages (because of defaulted arguments) #14354

Merged
merged 13 commits into from
Dec 13, 2023
Merged
2 changes: 1 addition & 1 deletion cpp/src/column/column_factories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ std::unique_ptr<column> make_dictionary_from_scalar(scalar const& s,
CUDF_EXPECTS(s.is_valid(stream), "cannot create a dictionary with a null key");
return make_dictionary_column(
make_column_from_scalar(s, 1, stream, mr),
make_column_from_scalar(numeric_scalar<uint32_t>(0), size, stream, mr),
make_column_from_scalar(numeric_scalar<uint32_t>(0, true, stream), size, stream, mr),
rmm::device_buffer{0, stream, mr},
0);
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/filling/fill.cu
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct in_place_fill_range_dispatch {
{
auto unscaled = static_cast<cudf::fixed_point_scalar<T> const&>(value).value(stream);
using RepType = typename T::rep;
auto s = cudf::numeric_scalar<RepType>(unscaled, value.is_valid(stream));
auto s = cudf::numeric_scalar<RepType>(unscaled, value.is_valid(stream), stream);
in_place_fill<RepType>(destination, begin, end, s, stream);
}

Expand Down
11 changes: 8 additions & 3 deletions cpp/src/groupby/groupby.cu
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,21 @@ struct empty_column_constructor {
using namespace cudf::detail;

if constexpr (k == aggregation::Kind::COLLECT_LIST || k == aggregation::Kind::COLLECT_SET) {
return make_lists_column(
0, make_empty_column(type_to_id<size_type>()), empty_like(values), 0, {});
return make_lists_column(0,
make_empty_column(type_to_id<size_type>()),
empty_like(values),
0,
{},
cudf::get_default_stream());
Copy link
Contributor

Choose a reason for hiding this comment

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

This is introducing a use of the default stream, which we want to avoid. There are public APIs accepting a user stream that can call this, which won't use the desired stream. We need to refactor all callers of this code path, and pass their stream through.

Copy link
Contributor

Choose a reason for hiding this comment

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

is the stream relevant in this case? Is any allocation actually happening when creating an empty column?

Copy link
Contributor

@ttnghia ttnghia Nov 6, 2023

Choose a reason for hiding this comment

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

I've filed an issue a while ago for it: #11463 and there is also another issue for it: #13737.

Copy link
Contributor

Choose a reason for hiding this comment

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

So before that issue is closed, we don't have any input stream to put into line 115 above and have to use the default stream anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

groupby needs a bigger cleanup; I can exclude it as part of this PR. It should be a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed groupby from this PR.

}

if constexpr (k == aggregation::Kind::HISTOGRAM) {
return make_lists_column(0,
make_empty_column(type_to_id<size_type>()),
cudf::reduction::detail::make_empty_histogram_like(values),
0,
{});
{},
cudf::get_default_stream());
}
if constexpr (k == aggregation::Kind::MERGE_HISTOGRAM) { return empty_like(values); }

Expand Down
10 changes: 6 additions & 4 deletions cpp/src/groupby/sort/aggregate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,11 @@ void aggregate_result_functor::operator()<aggregation::MERGE_HISTOGRAM>(aggregat
* @param column_1 The second column
* @return tuple with new null mask (if null masks of input differ) and new column views
*/
auto column_view_with_common_nulls(column_view const& column_0, column_view const& column_1)
auto column_view_with_common_nulls(column_view const& column_0,
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved
column_view const& column_1,
rmm::cuda_stream_view stream)
{
auto [new_nullmask, null_count] = cudf::bitmask_and(table_view{{column_0, column_1}});
auto [new_nullmask, null_count] = cudf::bitmask_and(table_view{{column_0, column_1}}, stream);
if (null_count == 0) { return std::make_tuple(std::move(new_nullmask), column_0, column_1); }
auto column_view_with_new_nullmask = [](auto const& col, void* nullmask, auto null_count) {
return column_view(col.type(),
Expand Down Expand Up @@ -610,7 +612,7 @@ void aggregate_result_functor::operator()<aggregation::COVARIANCE>(aggregation c
// Covariance only for valid values in both columns.
// in non-identical null mask cases, this prevents caching of the results - STD, MEAN, COUNT.
auto [_, values_child0, values_child1] =
column_view_with_common_nulls(values.child(0), values.child(1));
column_view_with_common_nulls(values.child(0), values.child(1), stream);

auto mean_agg = make_mean_aggregation();
aggregate_result_functor(values_child0, helper, cache, stream, mr).operator()<aggregation::MEAN>(*mean_agg);
Expand Down Expand Up @@ -659,7 +661,7 @@ void aggregate_result_functor::operator()<aggregation::CORRELATION>(aggregation
// Correlation only for valid values in both columns.
// in non-identical null mask cases, this prevents caching of the results - STD, MEAN, COUNT
auto [_, values_child0, values_child1] =
column_view_with_common_nulls(values.child(0), values.child(1));
column_view_with_common_nulls(values.child(0), values.child(1), stream);

auto std_agg = make_std_aggregation();
aggregate_result_functor(values_child0, helper, cache, stream, mr).operator()<aggregation::STD>(*std_agg);
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/groupby/sort/sort_helper.cu
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ column_view sort_groupby_helper::key_sort_order(rmm::cuda_stream_view stream)

if (_keys_pre_sorted == sorted::YES) {
_key_sorted_order = cudf::detail::sequence(_keys.num_rows(),
numeric_scalar<size_type>(0),
numeric_scalar<size_type>(1),
numeric_scalar<size_type>(0, true, stream),
numeric_scalar<size_type>(1, true, stream),
stream,
rmm::mr::get_current_device_resource());
return sliced_key_sorted_order();
Expand Down Expand Up @@ -236,7 +236,7 @@ column_view sort_groupby_helper::keys_bitmask_column(rmm::cuda_stream_view strea
auto [row_bitmask, null_count] =
cudf::detail::bitmask_and(_keys, stream, rmm::mr::get_current_device_resource());

auto const zero = numeric_scalar<int8_t>(0);
auto const zero = numeric_scalar<int8_t>(0, true, stream);
// Create a temporary variable and only set _keys_bitmask_column right before the return.
// This way, a 2nd (parallel) call to this will not be given a partially created object.
auto keys_bitmask_column = cudf::detail::sequence(
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/hash/md5_hash.cu
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ std::unique_ptr<column> md5(table_view const& input,
{
if (input.num_columns() == 0 || input.num_rows() == 0) {
// Return the MD5 hash of a zero-length input.
string_scalar const string_128bit("d41d8cd98f00b204e9orig98ecf8427e");
string_scalar const string_128bit("d41d8cd98f00b204e9orig98ecf8427e", true, stream);
return make_column_from_scalar(string_128bit, input.num_rows(), stream, mr);
}

Expand Down
4 changes: 2 additions & 2 deletions cpp/src/io/csv/reader_impl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -868,8 +868,8 @@ table_with_metadata read_csv(cudf::io::datasource* source,
// quotechars in quoted fields results in reduction to a single quotechar
// TODO: Would be much more efficient to perform this operation in-place
// during the conversion stage
std::string const quotechar(1, parse_opts.quotechar);
std::string const dblquotechar(2, parse_opts.quotechar);
cudf::string_scalar const quotechar(std::string(1, parse_opts.quotechar), true, stream);
cudf::string_scalar const dblquotechar(std::string(2, parse_opts.quotechar), true, stream);
vuule marked this conversation as resolved.
Show resolved Hide resolved
std::unique_ptr<column> col = cudf::make_strings_column(*out_buffers[i]._strings, stream);
out_columns.emplace_back(
cudf::strings::detail::replace(col->view(), dblquotechar, quotechar, -1, stream, mr));
Expand Down
25 changes: 15 additions & 10 deletions cpp/src/io/csv/writer_impl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ struct column_to_strings_fn {
column_view const& column) const
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved
{
return cudf::strings::detail::from_booleans(
column, options_.get_true_value(), options_.get_false_value(), stream_, mr_);
column,
cudf::string_scalar(options_.get_true_value(), true, stream_),
cudf::string_scalar(options_.get_false_value(), true, stream_),
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you mind making a change similar to the one in #14444?

stream_,
mr_);
}

// strings:
Expand Down Expand Up @@ -367,10 +371,10 @@ void write_chunked(data_sink* out_sink,

CUDF_EXPECTS(str_column_view.size() > 0, "Unexpected empty strings column.");

cudf::string_scalar newline{options.get_line_terminator()};
cudf::string_scalar newline{options.get_line_terminator(), true, stream};
auto p_str_col_w_nl = cudf::strings::detail::join_strings(str_column_view,
newline,
string_scalar("", false),
string_scalar("", false, stream),
Copy link
Contributor

Choose a reason for hiding this comment

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

newline is defined separately while the 3rd parameter is defined inline. Can you make them consistent please?

Copy link
Contributor Author

@karthikeyann karthikeyann Nov 3, 2023

Choose a reason for hiding this comment

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

I don't think, it's not a matter of being consistent. That temporary scalar is not required after this usage. So, it's not a named parameter. its scope ends after function call.
newline is used below.

stream,
rmm::mr::get_current_device_resource());
strings_column_view strings_column{p_str_col_w_nl->view()};
Expand Down Expand Up @@ -472,14 +476,15 @@ void write_csv(data_sink* out_sink,
//
std::string delimiter_str{options.get_inter_column_delimiter()};
auto str_concat_col = [&] {
cudf::string_scalar narep{options.get_na_rep(), true, stream};
if (str_table_view.num_columns() > 1)
return cudf::strings::detail::concatenate(str_table_view,
delimiter_str,
options.get_na_rep(),
strings::separator_on_nulls::YES,
stream,
rmm::mr::get_current_device_resource());
cudf::string_scalar narep{options.get_na_rep()};
return cudf::strings::detail::concatenate(
str_table_view,
cudf::string_scalar(delimiter_str, true, stream),
narep,
Copy link
Contributor

Choose a reason for hiding this comment

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

One parameter is inline defined while the other is not. Please make them consistent.

Copy link
Contributor Author

@karthikeyann karthikeyann Nov 3, 2023

Choose a reason for hiding this comment

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

That temporary scalar is not required after this usage. So, it's not a named parameter. its scopes end after function call.
Here narep is used below this line too.

strings::separator_on_nulls::YES,
stream,
rmm::mr::get_current_device_resource());
return cudf::strings::detail::replace_nulls(
str_table_view.column(0), narep, stream, rmm::mr::get_current_device_resource());
}();
Expand Down
6 changes: 5 additions & 1 deletion cpp/src/io/json/write_json.cu
vuule marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,11 @@ struct column_to_strings_fn {
column_view const& column) const
{
return cudf::strings::detail::from_booleans(
column, options_.get_true_value(), options_.get_false_value(), stream_, mr_);
column,
cudf::string_scalar(options_.get_true_value(), true, stream_),
cudf::string_scalar(options_.get_false_value(), true, stream_),
stream_,
mr_);
}

// strings:
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/io/parquet/writer_impl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ size_t column_size(column_view const& column, rmm::cuda_stream_view stream)
auto const scol = structs_column_view(column);
size_t ret = 0;
for (int i = 0; i < scol.num_children(); i++) {
ret += column_size(scol.get_sliced_child(i), stream);
ret += column_size(scol.get_sliced_child(i, stream), stream);
}
return ret;
} else if (column.type().id() == type_id::LIST) {
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/io/utilities/column_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ std::unique_ptr<column> make_column(column_buffer_base<string_policy>& buffer,
std::move(col_content.children[strings_column_view::offsets_column_index]),
std::move(uint8_col),
null_count,
std::move(*col_content.null_mask));
std::move(*col_content.null_mask),
stream);
}

case type_id::LIST: {
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/lists/dremel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ dremel_data get_encoding(column_view h_col,
}
std::unique_ptr<column> empty_list_offset_col;
if (has_empty_list_offsets) {
empty_list_offset_col = make_fixed_width_column(data_type(type_id::INT32), 1);
empty_list_offset_col =
make_fixed_width_column(data_type(type_id::INT32), 1, mask_state::UNALLOCATED, stream);
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved
CUDF_CUDA_TRY(cudaMemsetAsync(
empty_list_offset_col->mutable_view().head(), 0, sizeof(size_type), stream.value()));
std::function<column_view(column_view const&)> normalize_col = [&](column_view const& col) {
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/lists/interleave_columns.cu
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ struct interleave_list_entries_impl<T, std::enable_if_t<cudf::is_fixed_width<T>(
if (data_has_null_mask) {
auto [null_mask, null_count] = cudf::detail::valid_if(
validities.begin(), validities.end(), thrust::identity{}, stream, mr);
if (null_count > 0) { output->set_null_mask(null_mask, null_count); }
if (null_count > 0) { output->set_null_mask(std::move(null_mask), null_count); }
}

return output;
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/reductions/scan/scan_exclusive.cu
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ std::unique_ptr<column> scan_exclusive(column_view const& input,

auto output = scan_agg_dispatch<scan_dispatcher>(
input, agg, static_cast<bitmask_type*>(mask.data()), stream, mr);
output->set_null_mask(mask, null_count);
output->set_null_mask(std::move(mask), null_count);

return output;
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/reductions/scan/scan_inclusive.cu
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ std::unique_ptr<column> scan_inclusive(column_view const& input,

auto output = scan_agg_dispatch<scan_dispatcher>(
input, agg, static_cast<bitmask_type*>(mask.data()), stream, mr);
output->set_null_mask(mask, null_count);
output->set_null_mask(std::move(mask), null_count);

// If the input is a structs column, we also need to push down nulls from the parent output column
// into the children columns.
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/reductions/segmented/simple.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ std::unique_ptr<column> simple_segmented_reduction(

// Cast initial value
ResultType initial_value = [&] {
if (init.has_value() && init.value().get().is_valid()) {
if (init.has_value() && init.value().get().is_valid(stream)) {
using ScalarType = cudf::scalar_type_t<InputType>;
auto input_value = static_cast<ScalarType const*>(&init.value().get())->value(stream);
return static_cast<ResultType>(input_value);
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/reductions/segmented/update_validity.cu
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void segmented_update_validity(column& result,
offsets.end() - 1,
offsets.begin() + 1,
null_handling,
init.has_value() ? std::optional(init.value().get().is_valid()) : std::nullopt,
init.has_value() ? std::optional(init.value().get().is_valid(stream)) : std::nullopt,
stream,
mr);
result.set_null_mask(std::move(output_null_mask), output_null_count);
Expand Down
11 changes: 7 additions & 4 deletions cpp/src/reductions/simple.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ std::unique_ptr<scalar> simple_reduction(column_view const& col,

// Cast initial value
std::optional<ResultType> const initial_value = [&] {
if (init.has_value() && init.value().get().is_valid()) {
if (init.has_value() && init.value().get().is_valid(stream)) {
using ScalarType = cudf::scalar_type_t<ElementType>;
auto input_value = static_cast<ScalarType const*>(&init.value().get())->value(stream);
return std::optional<ResultType>(static_cast<ResultType>(input_value));
Expand All @@ -89,7 +89,8 @@ std::unique_ptr<scalar> simple_reduction(column_view const& col,

// set scalar is valid
result->set_valid_async(
col.null_count() < col.size() && (!init.has_value() || init.value().get().is_valid()), stream);
col.null_count() < col.size() && (!init.has_value() || init.value().get().is_valid(stream)),
stream);
return result;
}

Expand Down Expand Up @@ -130,7 +131,8 @@ std::unique_ptr<scalar> fixed_point_reduction(
auto result_scalar =
cudf::make_fixed_point_scalar<DecimalXX>(val->value(stream), scale, stream, mr);
result_scalar->set_valid_async(
col.null_count() < col.size() && (!init.has_value() || init.value().get().is_valid()), stream);
col.null_count() < col.size() && (!init.has_value() || init.value().get().is_valid(stream)),
stream);
return result_scalar;
}

Expand Down Expand Up @@ -169,7 +171,8 @@ std::unique_ptr<scalar> dictionary_reduction(

// set scalar is valid
result->set_valid_async(
col.null_count() < col.size() && (!init.has_value() || init.value().get().is_valid()), stream);
col.null_count() < col.size() && (!init.has_value() || init.value().get().is_valid(stream)),
stream);
return result;
}

Expand Down
13 changes: 8 additions & 5 deletions cpp/src/scalar/scalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ duration_scalar<T>::duration_scalar(duration_scalar<T> const& other,
template <typename T>
typename duration_scalar<T>::rep_type duration_scalar<T>::count()
{
return this->value().count();
return this->value(cudf::get_default_stream()).count();
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand All @@ -441,7 +441,7 @@ template class duration_scalar<duration_ns>;
template <typename T>
typename timestamp_scalar<T>::rep_type timestamp_scalar<T>::ticks_since_epoch()
{
return this->value().time_since_epoch().count();
return this->value(cudf::get_default_stream()).time_since_epoch().count();
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down Expand Up @@ -541,7 +541,7 @@ struct_scalar::struct_scalar(table_view const& data,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
: scalar(data_type(type_id::STRUCT), is_valid, stream, mr),
_data{init_data(table{data}, is_valid, stream, mr)}
_data{init_data(table{data, stream, mr}, is_valid, stream, mr)}
{
assert_valid_size();
}
Expand All @@ -551,8 +551,11 @@ struct_scalar::struct_scalar(host_span<column_view const> data,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
: scalar(data_type(type_id::STRUCT), is_valid, stream, mr),
_data{init_data(
table{table_view{std::vector<column_view>{data.begin(), data.end()}}}, is_valid, stream, mr)}
_data{
init_data(table{table_view{std::vector<column_view>{data.begin(), data.end()}}, stream, mr},
is_valid,
stream,
mr)}
{
assert_valid_size();
}
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/sort/sort_impl.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ std::unique_ptr<column> sorted_order(table_view input,
rmm::mr::device_memory_resource* mr)
{
if (input.num_rows() == 0 or input.num_columns() == 0) {
return cudf::make_numeric_column(data_type(type_to_id<size_type>()), 0);
return cudf::make_numeric_column(
data_type(type_to_id<size_type>()), 0, mask_state::UNALLOCATED, stream);
}

if (not column_order.empty()) {
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/strings/convert/convert_booleans.cu
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ std::unique_ptr<column> to_booleans(strings_column_view const& input,
rmm::mr::device_memory_resource* mr)
{
size_type strings_count = input.size();
if (strings_count == 0) return make_numeric_column(data_type{type_id::BOOL8}, 0);
if (strings_count == 0)
return make_numeric_column(data_type{type_id::BOOL8}, 0, mask_state::UNALLOCATED, stream);
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved

CUDF_EXPECTS(true_string.is_valid(stream) && true_string.size() > 0,
"Parameter true_string must not be empty.");
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/strings/convert/convert_durations.cu
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,8 @@ std::unique_ptr<column> to_durations(strings_column_view const& input,
rmm::mr::device_memory_resource* mr)
{
size_type strings_count = input.size();
if (strings_count == 0) return make_duration_column(duration_type, 0);
if (strings_count == 0)
return make_duration_column(duration_type, 0, mask_state::UNALLOCATED, stream);
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved

CUDF_EXPECTS(!format.empty(), "Format parameter must not be empty.");

Expand Down
3 changes: 2 additions & 1 deletion cpp/src/strings/convert/convert_floats.cu
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ std::unique_ptr<column> to_floats(strings_column_view const& input,
rmm::mr::device_memory_resource* mr)
{
size_type strings_count = input.size();
if (strings_count == 0) return make_numeric_column(output_type, 0);
if (strings_count == 0)
return make_numeric_column(output_type, 0, mask_state::UNALLOCATED, stream);
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved
auto strings_column = column_device_view::create(input.parent(), stream);
auto d_strings = *strings_column;
// create float output column copying the strings null-mask
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/strings/convert/convert_integers.cu
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ std::unique_ptr<column> to_integers(strings_column_view const& input,
rmm::mr::device_memory_resource* mr)
{
size_type strings_count = input.size();
if (strings_count == 0) return make_numeric_column(output_type, 0);
if (strings_count == 0)
return make_numeric_column(output_type, 0, mask_state::UNALLOCATED, stream);
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved

// Create integer output column copying the strings null-mask
auto results = make_numeric_column(output_type,
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/strings/convert/convert_ipv4.cu
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ std::unique_ptr<column> ipv4_to_integers(strings_column_view const& input,
rmm::mr::device_memory_resource* mr)
{
size_type strings_count = input.size();
if (strings_count == 0) return make_numeric_column(data_type{type_id::INT64}, 0);
if (strings_count == 0)
return make_numeric_column(data_type{type_id::INT64}, 0, mask_state::UNALLOCATED, stream);
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved

auto strings_column = column_device_view::create(input.parent(), stream);
// create output column copying the strings' null-mask
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/strings/filling/fill.cu
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ std::unique_ptr<column> fill(strings_column_view const& strings,
auto d_strings = *strings_column;

// create resulting null mask
auto valid_mask = [begin, end, d_value, value, d_strings, stream, mr] {
auto valid_mask = [begin, end, d_value, &value, d_strings, stream, mr] {
if (begin == 0 and end == d_strings.size() and value.is_valid(stream))
return std::pair(rmm::device_buffer{}, 0);
return cudf::detail::valid_if(
Expand Down
Loading