-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Make is_supported_cast fail for variable-width inputs #23613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -201,6 +201,12 @@ inline auto make_data_type() | |||||||||||||||||||||||||||||||||||||||||||||||||||
| return cudf::data_type{cudf::type_to_id<T>()}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| TEST(IsSupportedCast, StringToInt32IsUnsupported) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| EXPECT_FALSE(cudf::is_supported_cast(cudf::data_type{cudf::type_id::STRING}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| cudf::data_type{cudf::type_id::INT32})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+204
to
+208
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might want to add more assertions here for other non-fixed-width inputs (and rename the test appropriately, e.g.,
Suggested change
Footnotes
Comment on lines
+204
to
+208
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Use a Replace Based on learnings: “All libcudf unit tests should make use of a GTest Test Fixture” and “Even if the fixture is empty, it should inherit from the base fixture Proposed fix-TEST(IsSupportedCast, StringToInt32IsUnsupported)
+class IsSupportedCastTest : public cudf::test::BaseFixture {};
+
+TEST_F(IsSupportedCastTest, StringToInt32IsUnsupported)📝 Committable suggestion
Suggested change
🤖 Prompt for AI AgentsSource: Learnings 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n 'is_supported_cast|BENCHMARK' cppRepository: NVIDIA/cudf Length of output: 19219 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- cast test structure and nearby cases ---'
sed -n '1,235p' cpp/tests/unary/cast_tests.cpp
printf '%s\n' '--- cast implementation and declarations ---'
sed -n '120,160p' cpp/include/cudf/unary.hpp
sed -n '420,465p' cpp/src/unary/cast_ops.cu
printf '%s\n' '--- benchmark files with cast-related names ---'
git ls-files cpp/benchmarks | rg -i 'cast|unary'
printf '%s\n' '--- test fixture and benchmark guidance ---'
rg -n -C 3 'BaseFixture|fixture|unit benchmark|benchmark' cpp/tests/unary/cast_tests.cpp cpp/doxygen/developer_guide/TESTING.md cpp/doxygen/developer_guide/BENCHMARKING.md cpp/REVIEW_GUIDELINES.md CONTRIBUTING.mdRepository: NVIDIA/cudf Length of output: 30777 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- existing intcast benchmark ---'
wc -l cpp/benchmarks/string/intcast.cpp
sed -n '1,240p' cpp/benchmarks/string/intcast.cpp
printf '%s\n' '--- support predicate implementation ---'
sed -n '125,175p' cpp/src/unary/cast_ops.cu
printf '%s\n' '--- all is_supported_cast tests and nearby test declarations ---'
rg -n -C 5 'IsSupportedCast|is_supported_cast|TEST(_F)?\(' cpp/testsRepository: NVIDIA/cudf Length of output: 50368 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- existing intcast benchmark ---'
sed -n '1,220p' cpp/benchmarks/string/intcast.cpp
printf '%s\n' '--- support predicate body ---'
rg -n -A 45 -B 8 'constexpr inline auto is_supported_cast' cpp/src/unary/cast_ops.cu
printf '%s\n' '--- exact API references in tests and benchmarks ---'
rg -n 'cudf::is_supported_cast|is_supported_cast<' cpp/tests cpp/benchmarksRepository: NVIDIA/cudf Length of output: 5337 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- non-fixed-point support predicate ---'
sed -n '90,145p' cpp/src/unary/cast_ops.cu
printf '%s\n' '--- test target configuration ---'
rg -n -C 4 'cast_tests|unary' cpp/tests/CMakeLists.txt cpp/tests/unary/CMakeLists.txt 2>/dev/null || true
printf '%s\n' '--- concise support-test references ---'
rg -n 'IsSupportedCast|is_supported_cast' cpp/tests cpp/benchmarks cpp/src cpp/includeRepository: NVIDIA/cudf Length of output: 6462 Use a
🤖 Prompt for AI AgentsSource: Coding guidelines |
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| struct CastTimestampsSimple : public cudf::test::BaseFixture {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| TEST_F(CastTimestampsSimple, IsIdempotent) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note
Your PR description says that you're matching the "cudf cast documentation", but the cast will, in fact, fail for those non-fixed-width types, so you're in fact matching the cast implementation. Might be worth a tweak to the PR description…
[Optional] Might also be worth it to update the
is_supported_castfunction doc inunary.hpp(lines 129-136)…