cast_variant skips unsupported target type validation for empty inputs - #23462
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughSummary by CodeRabbit
Walkthrough
ChangesVARIANT cast validation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/ok to test c1e0e9d |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
cpp/tests/io/experimental/variant_extract_test.cpp (1)
387-463: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAdd
<bit>forstd::bit_castcpp/tests/io/experimental/variant_extract_test.cppusesstd::bit_castinenc_float64but doesn’t include<bit>, so compilation depends on an indirect include.🤖 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/io/experimental/variant_extract_test.cpp` around lines 387 - 463, Update the includes in variant_extract_test.cpp to directly include the standard <bit> header required by std::bit_cast in enc_float64, removing the dependency on indirect includes.
🤖 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.
Outside diff comments:
In `@cpp/tests/io/experimental/variant_extract_test.cpp`:
- Around line 387-463: Update the includes in variant_extract_test.cpp to
directly include the standard <bit> header required by std::bit_cast in
enc_float64, removing the dependency on indirect includes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: f0be71af-e328-4b13-a3c0-b417c204c187
📒 Files selected for processing (2)
cpp/src/io/parquet/experimental/variant_extract.cucpp/tests/io/experimental/variant_extract_test.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
- cpp/src/io/parquet/experimental/variant_extract.cu
|
/ok to test b0d37be |
| rmm::device_async_resource_ref mr) | ||
| { | ||
| validate_variant_child(values); | ||
| cudf::type_dispatcher(desired_type, validate_variant_type_fn{}); |
There was a problem hiding this comment.
Is there a way we can get rid of the type dispatcher here. It's generally quite expensive and the functor being dispatch seems trivial enough.
There was a problem hiding this comment.
yes, I have refactored it
There was a problem hiding this comment.
I think the comment only referred to validate_variant_type_fn, not the entire cast. I'm not sure that we want all casting in a single function.
There was a problem hiding this comment.
I have re-refactored it to address this comment!
|
/ok to test df6e561 |
|
Hi @abigalekim, please update the PR description to say what exactly we are doing here instead of just linking the issue 🙂. Please don't include the problem statement in the description, just what the PR exactly does and what does it fix in maybe a small 3-4 line paragraph |
| } | ||
|
|
||
| // Non-empty input: the dispatch path must also throw for unsupported types. | ||
| auto col = make_apache_variant(avf::primitive_int32); |
|
I have added the PR description as well! |
|
/ok to test 704c9bd |
|
/ok to test 480db43 |
|
/ok to test b35620a |
|
/ok to test 047d5bb |
|
/merge |
Description
Solves the issue mentioned in #23361. cast_variant now rejects unsupported desired_type values consistently, regardless of whether the input column is empty or non-empty. Supported empty casts, such as empty variant values to INT32 or STRING, continue to return empty columns. This PR also refactors the UnsupportedTypesThrows test, which now covers both the empty-input (early-return) path and the non-empty-input (dispatch) path.
Checklist