alexanderbianchi commented on code in PR #26890:
URL: https://github.com/apache/datafusion/pull/26890#discussion_r4498559180
##########
datafusion/substrait/src/logical_plan/consumer/substrait_consumer.rs:
##########
@@ -668,82 +656,62 @@ impl SubstraitConsumer for DefaultSubstraitConsumer<'_> {
.deserialize_logical_plan(&ext_detail.type_url,
&ext_detail.value)?;
let mut inputs = Vec::with_capacity(rel.inputs.len());
for input in &rel.inputs {
- let input_plan = self.consume_rel(input).await?;
+ let input_plan = self.consume_rel(input, context).await?;
inputs.push(input_plan);
}
let plan = plan.with_exprs_and_inputs(plan.expressions(), inputs)?;
Ok(LogicalPlan::Extension(Extension { node: plan }))
}
-
- fn push_lambda_parameters(
- &self,
- lambda_parameters: &[Type],
- input_schema: &DFSchema,
- ) -> datafusion::common::Result<Vec<String>> {
- self.lambda_consumer
- .push_lambda_parameters(self, lambda_parameters, input_schema)
- }
-
- fn pop_lambda_parameters(&self) {
- self.lambda_consumer.pop_lambda_parameters()
- }
-
- fn lambda_variable(
- &self,
- steps_out: usize,
- field_idx: usize,
- ) -> datafusion::common::Result<Expr> {
- self.lambda_consumer.lambda_variable(steps_out, field_idx)
- }
}
-/// Default implementation of lambda related methods of the
[SubstraitConsumer] trait
+/// Immutable lexical scope for one path through a Substrait plan.
///
-/// Can be embedded into a custom [SubstraitConsumer] to implement them
-pub struct DefaultSubstraitLambdaConsumer {
- inner: RwLock<DefaultSubstraitLambdaConsumerInner>,
-}
-
-struct DefaultSubstraitLambdaConsumerInner {
- /// Parameters of the lambdas currently in scope, ordered from innermost
- /// to outermost. Index 0 is the lambda being consumed; higher indices
- /// are enclosing lambdas, matching the `steps_out` value used by
- /// [`DefaultSubstraitLambdaConsumer::lambda_variable`] and
`LambdaParameterReference`.
+/// Pass the current context to child conversions. Enter a subquery or lambda
by
+/// deriving a child context; the parent stays unchanged, including on errors
or
+/// cancellation. Independent inputs may borrow the same context concurrently.
+#[derive(Debug, Clone, Default)]
+pub struct SubstraitConsumerContext {
+ outer_schemas: Vec<Arc<DFSchema>>,
lambda_parameters: VecDeque<Vec<FieldRef>>,
next_lambda_parameter: usize,
}
Review Comment:
Added 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: [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]