tustvold commented on code in PR #2640:
URL: https://github.com/apache/arrow-rs/pull/2640#discussion_r962196627
##########
arrow/src/array/cast.rs:
##########
@@ -225,6 +225,255 @@ macro_rules! downcast_primitive_array {
$($p => $fallback,)*
}
};
+
+ (($values1:ident, $values2:ident) => $e:block $($p:pat => $fallback:expr
$(,)*)*) => {
Review Comment:
This has an implicit assumption that $values1 and $values2 have the same
type, not only is this potentially surprising as an API, but I think it changes
the behaviour of the kernels which will now panic where previously they would
work?
Adding `$values2.data_type()` to the match might work, but it still feels a
bit confusing? :thinking:
I wonder if we could instead do something like this
```
downcast_primitive_array!(
left => {
let right = as_primitive_array(right);
multiply(left, right).map(|a| Arc::new(a) as ArrayRef)
}
_ => Err(ArrowError::CastError(format!(
"Unsupported data type {}, {}",
left.data_type(), right.data_type()
)))
)
```
And rely on the fact the generic kernels constrain them to be the same type.
I don't know, perhaps this is hack...
--
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]