diff --git a/cpp/src/transform/row_bit_count.cu b/cpp/src/transform/row_bit_count.cu index a91dc8fbbc6..e4698fb1262 100644 --- a/cpp/src/transform/row_bit_count.cu +++ b/cpp/src/transform/row_bit_count.cu @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -352,11 +353,12 @@ __device__ size_type row_size_functor::operator()(column_device_vie return 0; } - auto const offsets_size = sizeof(size_type) * CHAR_BIT; + auto const offsets_size = + (offsets.type().id() == type_id::INT32 ? sizeof(int32_t) : sizeof(int64_t)) * CHAR_BIT; auto const validity_size = col.nullable() ? 1 : 0; - auto const chars_size = - (offsets.data()[row_end] - offsets.data()[row_start]) * CHAR_BIT; - return ((offsets_size + validity_size) * num_rows) + chars_size; + auto const d_offsets = cudf::detail::input_offsetalator(offsets.head(), offsets.type()); + auto const chars_size = (d_offsets[row_end] - d_offsets[row_start]) * CHAR_BIT; + return static_cast(((offsets_size + validity_size) * num_rows) + chars_size); } /**