ump45nose opened a new pull request, #11978:
URL: https://github.com/apache/arrow-rs/pull/11978
# Which issue does this PR close?
- Closes #11939
# Rationale for this change
`cast_to_variant_with_options` with `CastOptions { safe: true }` encoded
conversion failures as `Variant::Null` while leaving the output row valid.
Arrow's cast kernel marks failed conversions null in the output array
(`CastOptions::safe`), and the module docs already document that input nulls
become array nulls rather than `Variant::Null`. Matching that model lets
TRY_CAST-style callers treat overflow / out-of-range conversions as SQL NULL
without a second pass.
# What changes are included in this PR?
In the `define_row_builder!` failure branch used by `cast_to_variant`,
safe-mode conversion failures now call `builder.append_null()` instead of
`append_value(Variant::Null)`. Tests that expected `Variant::Null` for overflow
/ out-of-range values (decimal, timestamp, date64, time32) now expect Arrow
nulls. Strict mode (`safe: false`) still returns an error.
# Are these changes tested?
Yes — `cargo test -p parquet-variant-compute --lib` (371 passed), including
the updated overflow / non-strict cases.
# Are there any significant user-facing changes?
Yes. Safe `cast_to_variant` failures are now null in the output
`VariantArray` instead of a non-null row holding `Variant::Null`. Callers that
previously special-cased `Variant::Null` for overflow should treat array nulls
the same way. Strict mode is unchanged.
## AI assistance
AI assisted with locating the failure branch, updating matching tests, and
drafting this PR description. I reviewed the change, ran the crate tests, and
own the result.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]