diff --git a/cpp/src/reshape/byte_cast.cu b/cpp/src/reshape/byte_cast.cu index 3e563a93cd1..2d629df6faa 100644 --- a/cpp/src/reshape/byte_cast.cu +++ b/cpp/src/reshape/byte_cast.cu @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -130,12 +131,16 @@ struct byte_list_conversion_fn( output_type, num_chars, std::move(*(col_content.data)), rmm::device_buffer{}, 0); - auto result = make_lists_column( - input.size(), - std::move(col_content.children[cudf::strings_column_view::offsets_column_index]), - std::move(uint8_col), - input.null_count(), - detail::copy_bitmask(input, stream, mr)); + auto offsets_col = std::move(col_content.children[strings_column_view::offsets_column_index]); + if (offsets_col->type().id() != type_id::INT32) { + offsets_col = cudf::detail::cast(offsets_col->view(), data_type{type_id::INT32}, stream, mr); + } + + auto result = make_lists_column(input.size(), + std::move(offsets_col), + std::move(uint8_col), + input.null_count(), + detail::copy_bitmask(input, stream, mr)); // If any nulls are present, the corresponding lists must be purged so that // the result is sanitized.