Blizzara commented on code in PR #13803:
URL: https://github.com/apache/datafusion/pull/13803#discussion_r1894445457
##########
datafusion/substrait/src/logical_plan/consumer.rs:
##########
@@ -262,7 +718,25 @@ async fn except_rels(
/// Convert Substrait Plan to DataFusion LogicalPlan
pub async fn from_substrait_plan(
- state: &dyn SubstraitPlanningState,
+ state: &SessionState,
+ plan: &Plan,
+) -> Result<LogicalPlan> {
+ // Register function extension
+ let extensions = Extensions::try_from(&plan.extensions)?;
+ if !extensions.type_variations.is_empty() {
+ return not_impl_err!("Type variation extensions are not supported");
+ }
+
+ let consumer = DefaultSubstraitConsumer {
+ extensions: &extensions,
+ state,
+ };
+ from_substrait_plan_with_consumer(&consumer, plan).await
+}
+
+/// Convert Substrait Plan to DataFusion LogicalPlan using the given consumer
+pub async fn from_substrait_plan_with_consumer(
+ consumer: &impl SubstraitConsumer,
Review Comment:
nit: I think if you want to, you could remove the Extension lines from below
- no need to duplicate them there given they're no longer used
##########
datafusion/substrait/src/logical_plan/consumer.rs:
##########
@@ -262,7 +718,25 @@ async fn except_rels(
/// Convert Substrait Plan to DataFusion LogicalPlan
pub async fn from_substrait_plan(
- state: &dyn SubstraitPlanningState,
+ state: &SessionState,
+ plan: &Plan,
+) -> Result<LogicalPlan> {
+ // Register function extension
+ let extensions = Extensions::try_from(&plan.extensions)?;
+ if !extensions.type_variations.is_empty() {
+ return not_impl_err!("Type variation extensions are not supported");
+ }
+
+ let consumer = DefaultSubstraitConsumer {
+ extensions: &extensions,
Review Comment:
I started thinking whether it actually really make sense to pass the
Extensions into the SubstraitConsumer, or if there should be some
`initialize(plan: &Plan)` method or something in the SubstraitConsumer that
loads them. But I didn't think yet much about it, maybe there is a reason to
rather have it like this, and anyways no need to change anything for this PR
anymore in any case 😄
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]