waynr commented on PR #7170: URL: https://github.com/apache/arrow-rs/pull/7170#issuecomment-2675213339
As the author of #7155 where my intent was to end up with something that could be compatible with datafusion's `SessionConfig` (ie such that we could transfer opaque trait objects from a `SessionConfig` instance to an object store extensions instance), this doesn't look like it will satisfy the need I've described. With the API surface you've provided for inserting new elements into `Extensions`, it would be impossible to insert items from a `SessionConfig`'s extensions into the new `Extensions` described here and still be able to retrieve them by their original type. Let's say that `SessionConfig`'s extensions carry an IOx `Span` (which I described in #7135 and #7155 as a motivating use case). In datafusion, I would like to be able to pass on all of the `SessionConfig` extensions to the `GetOptions` extensions such that a `Span` instance is retrievable from the latter. So if the `Arc<dyn ObjectStore>` receiving such a modified `GetOptions` needed a parent `Span` (and its associated span recording mechanisms), it could attempt to retrieve one using `opts.get::<Span>()'. The problem is that the `Span` type stored in the `SessionConfig` extensions for influxdb is stored as an opaque trait object -- and we can't downcast them in datafusion without adding a dependency to the shared IOx core crates where the `Span` type is defined. If we were to try iterating over `SessionConfig` extensions to insert them with `Extensions.set`, they would be indexed by their opaque trait object type -- `Arc<dyn Any + Send + Sync + 'static>` (and if there were more than one extension, I think only the last one would remain albeit irretrievable by its original type id). A `impl From<HashMap<TypeId, Arc<dyn Any + Send + Sync + 'static>>> for Extensions` should address this need. Or maybe a `impl Extend<(TypeId, Arc<dyn Any + Send + Sync + 'static>)> for Extensions`. -- 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-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org