Skip to content

Make is_supported_cast fail for variable-width inputs - #23613

Open
JohnZed wants to merge 4 commits into
NVIDIA:mainfrom
JohnZed:fix-is-supported-cast
Open

Make is_supported_cast fail for variable-width inputs#23613
JohnZed wants to merge 4 commits into
NVIDIA:mainfrom
JohnZed:fix-is-supported-cast

Conversation

@JohnZed

@JohnZed JohnZed commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Description

cudf is_supported_cast returns true for string inputs. But cudf cast documentation says that it does not support variable-width
types.

This leads to an issue in velox (facebookincubator/velox#18450) where the engine thinks it can
use cudf cast to convert varchars to ints, though that will ultimately need an exception. Velox will eventually need to use
a different strings API for this conversion, but at least changing is_supported_cast will allow it to no longer route conversions
through this path.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@copy-pr-bot

copy-pr-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the libcudf Affects libcudf (C++/CUDA) code. label Aug 10, 2026
@JohnZed JohnZed added bug Something isn't working non-breaking Non-breaking change labels Aug 10, 2026

@bdice bdice left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@PointKernel

Copy link
Copy Markdown
Member

pre-commit.ci autofix

@PointKernel

Copy link
Copy Markdown
Member

/ok to test 52419b5

@JohnZed
JohnZed marked this pull request as ready for review August 10, 2026 21:52
@JohnZed
JohnZed requested a review from a team as a code owner August 10, 2026 21:52
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 539668b2-eab0-418d-bbb0-1c5bf34fd1d3

📥 Commits

Reviewing files that changed from the base of the PR and between 52419b5 and 34b1762.

📒 Files selected for processing (1)
  • cpp/tests/unary/cast_tests.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • cpp/tests/unary/cast_tests.cpp

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Corrected cast support validation to consistently require fixed-width source and target types.
    • Casting from STRING to INT32 is now correctly reported as unsupported.
  • Tests

    • Added coverage verifying unsupported string-to-integer cast behavior.

Walkthrough

The cast support check now requires fixed-width source and target types. A unit test verifies that casting from STRING to INT32 is unsupported. SPDX notices were updated.

Changes

Cast support validation

Layer / File(s) Summary
Cast predicate and regression test
cpp/src/unary/cast_ops.cu, cpp/tests/unary/cast_tests.cpp
is_supported_non_fixed_point_cast now checks both source and target fixed-width types. A test verifies that STRING to INT32 is unsupported. SPDX notices were updated.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • rapidsai/cudf#23462: Both PRs modify cast-type validation and unsupported cast behavior in different APIs and code paths.

Suggested reviewers: abigalekim, igorpeshansky

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: rejecting variable-width inputs in is_supported_cast.
Description check ✅ Passed The description explains the variable-width input issue, its Velox impact, and the included test coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
cpp/tests/unary/cast_tests.cpp (1)

204-208: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover variable-width targets too.

The implementation checks both From and To, but this test only checks a variable-width source. Add an INT32 to STRING assertion so a regression in the target check cannot pass unnoticed.

Proposed test extension
+  EXPECT_FALSE(cudf::is_supported_cast(cudf::data_type{cudf::type_id::INT32},
+                                       cudf::data_type{cudf::type_id::STRING}));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cpp/tests/unary/cast_tests.cpp` around lines 204 - 208, Extend the
StringToInt32IsUnsupported test to also assert that an INT32 source to STRING
target is unsupported, covering the variable-width target path while preserving
the existing assertion.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@cpp/tests/unary/cast_tests.cpp`:
- Around line 204-208: Extend the StringToInt32IsUnsupported test to also assert
that an INT32 source to STRING target is unsupported, covering the
variable-width target path while preserving the existing assertion.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d85c5012-f405-490c-8203-2bd7700e60d6

📥 Commits

Reviewing files that changed from the base of the PR and between 463fba2 and 52419b5.

📒 Files selected for processing (2)
  • cpp/src/unary/cast_ops.cu
  • cpp/tests/unary/cast_tests.cpp

@JohnZed

JohnZed commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 34b1762

@JohnZed

JohnZed commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 2b79f91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants