vbarua opened a new pull request, #13803: URL: https://github.com/apache/datafusion/pull/13803
Note: When reviewing this PR I would recommend hiding whitespace changes. ## Which issue does this PR close? Initial work for https://github.com/apache/datafusion/issues/13318 ## Rationale for this change Improves the reusability of the Substrait consumer for users that utilize user-defined extensions and types. ## What changes are included in this PR? * Relation and expression handling code has been extracted into a series of `from_substrait_*` functions (i.e. `from_filter_rel`, `from_scalar_function`) to aid re-use. * A `SubstraitConsumer` trait has been introduced with default methods that handle relations and expression using the above functions. * The `SubstraitConsumer` trait also includes methods for handling extension relations (i.e `consume_extension_single`) along with user-defined types (`consume_user_defined_type`, `consume_user_defined_literal`). * All conversion methods take as their first argument an `&impl SubstraitConsumer`. * The role of `SubstraitPlanningState` has been subsumed into the `SubstraitConsumer`. ## Are these changes tested? These changes refactor existing code and leverage their tests. A doc comment has been added to show how the `SubstraitConsumer` trait can be implemented by users. ## Are there any user-facing changes? Yes. The top-level `from_substrait_plan(state, plan)` function now takes a `&SessionState` as its first argument, instead of `&dyn SubstraitPlanningState`. The same is true for `from_substrait_extended_expr`. These two functions are the primary external facing APIs for intiation a conversion. A number of functions like `from_substrait_rel`, `from_substrait_rex`, etc have had their API changed to make the first argument `&impl SubstraitConsumer`, and remove all `state: &dyn SubstraitPlanningState` and `extensions: &Extensions` arguments. -- 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...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org