klion26 commented on issue #8982: URL: https://github.com/apache/arrow-rs/issues/8982#issuecomment-4053798018
@scovich, sorry for the late reply; this notification mail is located in a different folder this time. > so unifying them would require factoring out a common scalar cast capability? Yes, we can unify the common cast logic for most of them, but some may not be easy to unify; we'll unify/reuse the common logic as much as possible. - like `Int32` -> `Date32` cast kernel use [`(Int32, Date32) => cast_reinterpret_arrays::<Int32Type, Date32Type>(array)`](https://github.com/apache/arrow-rs/blob/92a239a54e33043f05fef98d81d3c7bd2b926467/arrow-cast/src/cast/mod.rs#L1619), but for variant, current is `Variant::as_naive_date` (will return `NaiveDate`) and will do [`Date32Type::from_naive_date(x)`](https://github.com/apache/arrow-rs/blob/92a239a54e33043f05fef98d81d3c7bd2b926467/parquet-variant-compute/src/type_conversion.rs#L74) when builder.append(value) - like `Timestamp -> Timestamp`, it may not be easy to unify without performance sacrifice(did not find a solution, but need to confirm it), the logic is as follows https://github.com/apache/arrow-rs/blob/92a239a54e33043f05fef98d81d3c7bd2b926467/arrow-cast/src/cast/mod.rs#L1782-L1803 Anyway, seems we need to do the cast logic in `Variant::as_xx`, will push one pr to explain it better -- 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]
