You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "findepi (via GitHub)" <gi...@apache.org> on 2025/09/12 07:19:24 UTC
[PR] Fix `can_cast_types` for temporal to `Utf8View` [arrow-rs]
findepi opened a new pull request, #8328:
URL: https://github.com/apache/arrow-rs/pull/8328
`cast` and `cast_with_options` gained support for casting from temporal values to `Utf8View` in e613622fb69a7cc941bfb97bf1020bee580cfb86. This updates `can_cast_types` to match. This is necessary for DataFusion to use this casts, as DF consults `can_cast_types` first.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix `can_cast_types` for temporal to `Utf8View` [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #8328:
URL: https://github.com/apache/arrow-rs/pull/8328#discussion_r2346575847
##########
arrow-cast/src/cast/mod.rs:
##########
@@ -5775,28 +5774,9 @@ mod tests {
assert!(c.is_null(2));
}
- #[test]
- fn test_cast_date32_to_string() {
- let array = Date32Array::from(vec![10000, 17890]);
- let b = cast(&array, &DataType::Utf8).unwrap();
- let c = b.as_any().downcast_ref::<StringArray>().unwrap();
- assert_eq!(&DataType::Utf8, c.data_type());
- assert_eq!("1997-05-19", c.value(0));
- assert_eq!("2018-12-25", c.value(1));
- }
-
- #[test]
- fn test_cast_date64_to_string() {
- let array = Date64Array::from(vec![10000 * 86400000, 17890 * 86400000]);
- let b = cast(&array, &DataType::Utf8).unwrap();
- let c = b.as_any().downcast_ref::<StringArray>().unwrap();
- assert_eq!(&DataType::Utf8, c.data_type());
- assert_eq!("1997-05-19T00:00:00", c.value(0));
- assert_eq!("2018-12-25T00:00:00", c.value(1));
- }
-
- macro_rules! assert_cast_timestamp_to_string {
+ macro_rules! assert_cast {
($array:expr, $datatype:expr, $output_array_type: ty, $expected:expr) => {{
+ assert!(can_cast_types($array.data_type(), &$datatype));
Review Comment:
👍
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix `can_cast_types` for temporal to `Utf8View` [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #8328:
URL: https://github.com/apache/arrow-rs/pull/8328
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org