alamb commented on a change in pull request #1129:
URL: https://github.com/apache/arrow-rs/pull/1129#discussion_r778779669
##########
File path: arrow/src/array/cast.rs
##########
@@ -21,7 +21,7 @@ use crate::array::*;
use crate::datatypes::*;
/// Force downcast ArrayRef to PrimitiveArray<T>
-pub fn as_primitive_array<T>(arr: &ArrayRef) -> &PrimitiveArray<T>
+pub fn as_primitive_array<T>(arr: &dyn Array) -> &PrimitiveArray<T>
Review comment:
FWIW this change means that calls that pass in a `&ArrayRef` will
generate an extra dispatch as pointed out by @tustvold on
https://github.com/apache/arrow-rs/issues/1128#issuecomment-1003747568 -- this
can be avoided by the user calling `as_primitive_array(arr.as_ref())` or
`as_primitive_array(&*arr)` if it is important to avoid the double dispatch
--
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]