Describe the bug
cast_to_variant will panic for values of Date64 / Timestamp that can not be converted to NaiveDate
For example:
|
|v: i64| { Date64Type::to_naive_date_opt(v).unwrap() }, |
And
|
|v| NaiveTime::from_num_seconds_from_midnight_opt(v as u32, 0u32).unwrap(), |
To Reproduce
Pass in some value that is not representable as a NaiveDate (needs research to figure out what that could be)
It will panic
Expected behavior
I think we should have some way to specify what to do if the conversion fails, similar to the cast kernel which has a strict mode
if strict is true, then if the conversion fails an error is returned
If struct is false, then if the conversion fails, a Null is output
Additional context
Describe the bug
cast_to_variantwill panic for values ofDate64/Timestampthat can not be converted to NaiveDateFor example:
arrow-rs/parquet-variant-compute/src/cast_to_variant.rs
Line 500 in ace8dad
And
arrow-rs/parquet-variant-compute/src/cast_to_variant.rs
Line 364 in ace8dad
To Reproduce
Pass in some value that is not representable as a NaiveDate (needs research to figure out what that could be)
It will panic
Expected behavior
I think we should have some way to specify what to do if the conversion fails, similar to the
castkernel which has astrictmodeif
strictis true, then if the conversion fails an error is returnedIf
structis false, then if the conversion fails, a Null is outputAdditional context