From 48f80e3d50bcd646ebfb81dd5b85cf37f7ad06c5 Mon Sep 17 00:00:00 2001 From: John Zedlewski Date: Mon, 10 Aug 2026 20:54:34 +0000 Subject: [PATCH 1/5] Make is_supported_cast fail for variable-width inputs --- cpp/src/unary/cast_ops.cu | 3 ++- cpp/tests/unary/cast_tests.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cpp/src/unary/cast_ops.cu b/cpp/src/unary/cast_ops.cu index fcee2b368fcc..60f50eb8aa88 100644 --- a/cpp/src/unary/cast_ops.cu +++ b/cpp/src/unary/cast_ops.cu @@ -118,7 +118,8 @@ struct fixed_point_unary_cast { template constexpr inline auto is_supported_non_fixed_point_cast() { - return cudf::is_fixed_width() && + return cudf::is_fixed_width() && + cudf::is_fixed_width() && // Disallow fixed_point here (requires different specialization) !(cudf::is_fixed_point() || cudf::is_fixed_point()) && // Disallow conversions between timestamps and numeric diff --git a/cpp/tests/unary/cast_tests.cpp b/cpp/tests/unary/cast_tests.cpp index 5fcec956a8d9..fad01dee272d 100644 --- a/cpp/tests/unary/cast_tests.cpp +++ b/cpp/tests/unary/cast_tests.cpp @@ -201,6 +201,12 @@ inline auto make_data_type() return cudf::data_type{cudf::type_to_id()}; } +TEST(IsSupportedCast, StringToInt32IsUnsupported) +{ + EXPECT_FALSE(cudf::is_supported_cast(cudf::data_type{cudf::type_id::STRING}, + cudf::data_type{cudf::type_id::INT32})); +} + struct CastTimestampsSimple : public cudf::test::BaseFixture {}; TEST_F(CastTimestampsSimple, IsIdempotent) From dfb999b60e2cf1a7928281e149333e151e9eff30 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 10 Aug 2026 21:46:50 +0000 Subject: [PATCH 2/5] [pre-commit.ci] auto code formatting --- cpp/src/unary/cast_ops.cu | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cpp/src/unary/cast_ops.cu b/cpp/src/unary/cast_ops.cu index 60f50eb8aa88..49fbbf76e663 100644 --- a/cpp/src/unary/cast_ops.cu +++ b/cpp/src/unary/cast_ops.cu @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. + * SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ @@ -118,8 +118,7 @@ struct fixed_point_unary_cast { template constexpr inline auto is_supported_non_fixed_point_cast() { - return cudf::is_fixed_width() && - cudf::is_fixed_width() && + return cudf::is_fixed_width() && cudf::is_fixed_width() && // Disallow fixed_point here (requires different specialization) !(cudf::is_fixed_point() || cudf::is_fixed_point()) && // Disallow conversions between timestamps and numeric From e86fcff0da9cdd99832df29c76acbd6e8acae3a4 Mon Sep 17 00:00:00 2001 From: John Zedlewski Date: Mon, 10 Aug 2026 22:12:26 +0000 Subject: [PATCH 3/5] Fix cast tests header comment --- cpp/tests/unary/cast_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/tests/unary/cast_tests.cpp b/cpp/tests/unary/cast_tests.cpp index fad01dee272d..1fa8a825670d 100644 --- a/cpp/tests/unary/cast_tests.cpp +++ b/cpp/tests/unary/cast_tests.cpp @@ -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 */ From 7edb940971773704d8ced259e97885544e23439c Mon Sep 17 00:00:00 2001 From: John Zedlewski <904524+JohnZed@users.noreply.github.com> Date: Thu, 13 Aug 2026 17:59:50 -0700 Subject: [PATCH 4/5] Expand to test multiple unsupported input types in IsSupportedCase test Co-authored-by: Igor Peshansky <7594381+igorpeshansky@users.noreply.github.com> --- cpp/tests/unary/cast_tests.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cpp/tests/unary/cast_tests.cpp b/cpp/tests/unary/cast_tests.cpp index 1fa8a825670d..1830422344e7 100644 --- a/cpp/tests/unary/cast_tests.cpp +++ b/cpp/tests/unary/cast_tests.cpp @@ -201,10 +201,13 @@ inline auto make_data_type() return cudf::data_type{cudf::type_to_id()}; } -TEST(IsSupportedCast, StringToInt32IsUnsupported) +TEST(IsSupportedCast, UnsupportedTypes) { - EXPECT_FALSE(cudf::is_supported_cast(cudf::data_type{cudf::type_id::STRING}, - cudf::data_type{cudf::type_id::INT32})); + auto const to_int32 = cudf::data_type{cudf::type_id::INT32}; + EXPECT_FALSE(cudf::is_supported_cast(cudf::data_type{cudf::type_id::STRING}, to_int32)); + EXPECT_FALSE(cudf::is_supported_cast(cudf::data_type{cudf::type_id::LIST}, to_int32)); + EXPECT_FALSE(cudf::is_supported_cast(cudf::data_type{cudf::type_id::STRUCT}, to_int32)); + EXPECT_FALSE(cudf::is_supported_cast(cudf::data_type{cudf::type_id::DICTIONARY32}, to_int32)); } struct CastTimestampsSimple : public cudf::test::BaseFixture {}; From 8914db238fbec15a345f3d7a8bfb0e3798594d5a Mon Sep 17 00:00:00 2001 From: John Zedlewski Date: Fri, 14 Aug 2026 01:22:18 +0000 Subject: [PATCH 5/5] Update cast header docs to reflect variable width inputs unsupported --- cpp/include/cudf/unary.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/include/cudf/unary.hpp b/cpp/include/cudf/unary.hpp index 316e031a02d0..7cc352ab14ee 100644 --- a/cpp/include/cudf/unary.hpp +++ b/cpp/include/cudf/unary.hpp @@ -117,7 +117,7 @@ std::unique_ptr is_valid( * @param mr Device memory resource used to allocate the returned column's device memory * * @returns Column of same size as `input` containing result of the cast operation - * @throw cudf::logic_error if `out_type` is not a fixed-width type + * @throw cudf::logic_error if `input` or `out_type` is not a fixed-width type */ std::unique_ptr cast( column_view const& input,