tustvold commented on code in PR #3115:
URL: https://github.com/apache/arrow-rs/pull/3115#discussion_r1022279925
##########
arrow-array/src/array/mod.rs:
##########
@@ -372,6 +372,28 @@ impl<'a, T: Array> Array for &'a T {
}
}
+/// A kind of `Array` which can be downcasted by `downcast_array`.
+pub(crate) trait SizedArray: AsDynAny + Array {}
+
+/// A trait used to help conversion from `Arc<Self>` to `Arc<Any>`.
+pub(crate) trait AsDynAny: Any {
+ fn as_dyn_any(self: Arc<Self>) -> Arc<dyn Any + Send + Sync + 'static>;
+}
+
+impl<T: Sized + Send + Sync + 'static> AsDynAny for T {
+ fn as_dyn_any(self: Arc<Self>) -> Arc<dyn Any + Send + Sync + 'static> {
+ self
+ }
+}
+
+/// Downcasts an Arc-ed sized `Array` to Arc-ed underlying arrow type.
+#[allow(dead_code)]
+pub(crate) fn downcast_array<T: Send + Sync + 'static>(
+ array: Arc<dyn SizedArray>,
Review Comment:
How do you go from an `ArrayRef` to `Arc<dyn SizedArray>`?
Edit: Is the intention to change `ArrayRef` to be `Arc<dyn SizedArray>`?
:thinking:
--
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]