bvolpato opened a new issue, #20971: URL: https://github.com/apache/datafusion/issues/20971
### Describe the bug The Substrait producer and consumer do not support DataFusion's `Expr::Placeholder` (bind parameters like `$1`, `$name`). Both directions return `not_impl_err!`: **Producer** ([producer/expr/mod.rs:145](https://github.com/apache/datafusion/blob/main/datafusion/substrait/src/logical_plan/producer/expr/mod.rs#L145)): ```rust Expr::Placeholder(expr) => not_impl_err!("Cannot convert {expr:?} to Substrait"), ``` **Consumer** ([substrait_consumer.rs:367-373](https://github.com/apache/datafusion/blob/main/datafusion/substrait/src/logical_plan/consumer/substrait_consumer.rs#L367-L373)): ```rust async fn consume_dynamic_parameter( &self, _expr: &DynamicParameter, _input_schema: &DFSchema, ) -> datafusion::common::Result<Expr> { not_impl_err!("Dynamic Parameter expression not supported") } ``` ### To Reproduce Any query involving bind parameters (e.g. prepared statements) cannot be serialized to or deserialized from Substrait: ```rust // Producer: fails let expr = Expr::Placeholder(Placeholder::new_with_field("$1".into(), Some(Arc::new(Field::new("$1", DataType::Int32, false))))); // Cannot convert to Substrait // Consumer: fails // A Substrait plan containing DynamicParameter cannot be consumed ``` ### Expected behavior The mapping between DataFusion `Placeholder` and Substrait `DynamicParameter` should work in both directions: | DataFusion | Substrait | |---|---| | `Placeholder.id` (`"$1"`) | `DynamicParameter.parameter_reference` (extracted index) | | `Placeholder.field` (type info) | `DynamicParameter.type` | ### Additional context `DynamicParameter` was recently added to the Substrait spec and is now supported across the ecosystem: - **substrait-java**: [PR #752](https://github.com/substrait-io/substrait-java/pull/752) (merged) - **substrait-go**: [PR #215](https://github.com/substrait-io/substrait-go/pull/215) (open) - **substrait-rs**: [PR #481](https://github.com/substrait-io/substrait-rs/pull/481) (open, CI green) DataFusion is the last major consumer without support. -- 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]
