alamb commented on code in PR #2940:
URL: https://github.com/apache/arrow-datafusion/pull/2940#discussion_r923635322
##########
datafusion/core/src/execution/context.rs:
##########
@@ -1173,6 +1215,29 @@ impl SessionConfig {
);
map
}
+
+ /// Add extensions.
+ pub fn with_extension<T>(mut self, ext: Arc<T>) -> Self
+ where
+ T: Send + Sync + 'static,
+ {
+ let ext = ext as Arc<dyn Any + Send + Sync + 'static>;
+ let id = TypeId::of::<T>();
+ self.extensions.insert(id, ext);
+ self
+ }
+
+ /// Get extension.
Review Comment:
```suggestion
/// Get extension, if any, for the specific Id
```
##########
datafusion/core/src/execution/context.rs:
##########
@@ -1173,6 +1215,29 @@ impl SessionConfig {
);
map
}
+
+ /// Add extensions.
Review Comment:
Can you possibly add some documentation on what one might do with extensions
(e.g. attach arbitrary data to nodes) and mention the system specific metric
usecase?
Perhaps moving the test into a docstring comment would be the most helpful
for future readers to discover this functionality
It is probably also good to document that only a single entry for at type is
allowed (e.g. what happens if you register two extensions with the same type).
--
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]