alamb commented on PR #8447: URL: https://github.com/apache/arrow-datafusion/pull/8447#issuecomment-1847630286
> Maybe the best solution is to create an intermediate struct that contains the various HashMaps of SessionState, an pass that struct to the Analyzer, as well as the SessionState constructor? Suggestions are welcome :) Do you mean follow the model of [try_optimize](https://docs.rs/datafusion/latest/datafusion/optimizer/trait.OptimizerRule.html#tymethod.try_optimize) ```rust /// `OptimizerRule` transforms one [`LogicalPlan`] into another which /// computes the same results, but in a potentially more efficient /// way. If there are no suitable transformations for the input plan, /// the optimizer can simply return it as is. pub trait OptimizerRule { /// Try and rewrite `plan` to an optimized form, returning None if the plan cannot be /// optimized by this rule. fn try_optimize( &self, plan: &LogicalPlan, config: &dyn OptimizerConfig, ) -> Result<Option<LogicalPlan>>; ... ``` Maybe we could do something similar for AnalayzerRules like ```rust pub trait AnalyzerRule { /// Rewrite `plan` fn analyze(&self, plan: LogicalPlan, config: &AnalyzerConfig) -> Result<LogicalPlan>; ... } /// Options to control DataFusion Analyzer Passes. pub trait AnalyzerConfig { /// Return a function registry for resolving names fn function_registry(&self) -> &dyn FunctionRegistry; /// return datafusion configuration options fn options(&self) -> &ConfigOptions; } ``` I am not sure if the compiler will be happy with that construction or not so we may have to play around with it Let me know if you want me to give it a try Thanks for pushing this along cc @2010YOUY01 -- 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]
