tustvold commented on code in PR #2902:
URL: https://github.com/apache/arrow-rs/pull/2902#discussion_r1003636271
##########
arrow-array/src/array/mod.rs:
##########
@@ -258,6 +283,10 @@ impl Array for ArrayRef {
self.as_ref().as_any()
}
+ fn as_any_arc(self: Arc<Self>) -> Option<Arc<dyn Any + Send + Sync +
'static>> {
Review Comment:
> as_any "above" (i.e. in the same impl) returns None
No it returns `self.as_ref().as_any()`. My point here is much like the other
cases, we only have a reference to the underlying `dyn Array` here through an
`Arc`. As written this method will return a `Arc<dyn Any>` that will downcast
to an `Arc<ArrayRef>`, as opposed to `as_any()` which will downcast to
`PrimitiveArray`, etc... I think this is a bit off perhaps? Given we have the
ability to return `None` for cases where "this doesn't make sense" perhaps we
could use it here?
Alternatively we could clone the inner `ArrayRef` and downcast that
:thinking:
> TBH I don't really like this solution but couldn't come up with something
more elegant
Ditto, hence my suggestion to hide it away in a private trait so we can
revisit it later perhaps
--
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]