Skip to content

Commit

Permalink
Followup for null count fixup in row_conversion.cu.
Browse files Browse the repository at this point in the history
This is a followup to NVIDIA#1148.

`row_conversion.cu` was modified in rapidsai/cudf#13372
to explicitly calculate null-counts for output columns.

This commit replicates the changes in cudf/pull/13372, and adds explicit
null-count calculation for the string offsets column.

Signed-off-by: MithunR <[email protected]>
  • Loading branch information
mythrocks committed May 22, 2023
1 parent a6985de commit 21347a8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/main/cpp/src/row_conversion.cu
Original file line number Diff line number Diff line change
Expand Up @@ -2259,8 +2259,14 @@ std::unique_ptr<table> convert_from_rows(lists_column_view const &input,
for (int i = 0; i < static_cast<int>(schema.size()); ++i) {
if (schema[i].id() == type_id::STRING) {
// stuff real string column
auto const null_count = string_row_offset_columns[string_idx]->null_count();
auto string_data = string_row_offset_columns[string_idx].release()->release();
auto const null_count = [&] {
auto const &null_mask = *string_data.null_mask;
return null_mask.data() ?
cudf::null_count(static_cast<bitmask_type const *>(null_mask.data()), 0,
num_rows) :
0;
}();
output_columns[i] =
make_strings_column(num_rows, std::move(string_col_offsets[string_idx]),
std::move(string_data_cols[string_idx]),
Expand All @@ -2270,6 +2276,9 @@ std::unique_ptr<table> convert_from_rows(lists_column_view const &input,
}
}

for (auto &col : output_columns) {
col->set_null_count(cudf::null_count(col->view().null_mask(), 0, col->size()));
}
return std::make_unique<table>(std::move(output_columns));
}

Expand Down Expand Up @@ -2325,6 +2334,9 @@ std::unique_ptr<table> convert_from_rows_fixed_width_optimized(
num_rows, num_columns, size_per_row, dev_column_start.data(), dev_column_size.data(),
dev_output_data.data(), dev_output_nm.data(), child.data<int8_t>());

for (auto &col : output_columns) {
col->set_null_count(cudf::null_count(col->view().null_mask(), 0, col->size()));
}
return std::make_unique<table>(std::move(output_columns));
} else {
CUDF_FAIL("Only fixed width types are currently supported");
Expand Down

0 comments on commit 21347a8

Please sign in to comment.