From 542d3db023feae1e27b4d4b05679bc90173892be Mon Sep 17 00:00:00 2001 From: David Wendt Date: Fri, 31 May 2024 17:36:00 -0400 Subject: [PATCH] Fix debug assert in rowgroup_char_counts_kernel --- cpp/src/io/orc/dict_enc.cu | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cpp/src/io/orc/dict_enc.cu b/cpp/src/io/orc/dict_enc.cu index 5181c4a1c0e..5be75350951 100644 --- a/cpp/src/io/orc/dict_enc.cu +++ b/cpp/src/io/orc/dict_enc.cu @@ -44,12 +44,13 @@ CUDF_KERNEL void rowgroup_char_counts_kernel(device_2dspan char_count auto const start_row = rowgroup_bounds[row_group_idx][col_idx].begin + str_col.offset(); auto const num_rows = rowgroup_bounds[row_group_idx][col_idx].size(); - auto const& offsets = str_col.child(strings_column_view::offsets_column_index); - auto const offsets_itr = cudf::detail::input_offsetalator(offsets.head(), offsets.type()); - char_counts[str_col_idx][row_group_idx] = - (num_rows == 0) - ? 0 - : static_cast(offsets_itr[start_row + num_rows] - offsets_itr[start_row]); + size_type char_count = 0; + if (num_rows > 0) { + auto const& offsets = str_col.child(strings_column_view::offsets_column_index); + auto const offsets_itr = cudf::detail::input_offsetalator(offsets.head(), offsets.type()); + char_count = static_cast(offsets_itr[start_row + num_rows] - offsets_itr[start_row]); + } + char_counts[str_col_idx][row_group_idx] = char_count; } void rowgroup_char_counts(device_2dspan counts,