bvolpato-dd opened a new pull request, #20976: URL: https://github.com/apache/datafusion/pull/20976
## Which issue does this PR close? - Closes https://github.com/apache/datafusion/issues/20971. ## Rationale for this change The Substrait producer previously returned `not_impl_err!` for `Expr::Placeholder`, meaning any query plan containing parameterized expressions (e.g. `$1`, `$2`) could not be serialized to Substrait. This gap prevented roundtripping prepared statement plans through the Substrait layer. ## What changes are included in this PR? **Producer:** - New `placeholder.rs` module with `from_placeholder` that converts `Expr::Placeholder` to `DynamicParameter`, mapping one-based `$N` DataFusion ids to zero-based Substrait `parameter_reference` values with optional type information. - `handle_placeholder` added to the `SubstraitProducer` trait. **Consumer:** - `consume_dynamic_parameter` converts Substrait `DynamicParameter` back to `Expr::Placeholder`, reversing the index mapping and type conversion. ## Are these changes tested? Yes. Five new integration tests and one unit test: - `roundtrip_placeholder_sql_filter` — SQL-based, `WHERE a > $1` - `roundtrip_placeholder_sql_projection` — SQL-based, `$1` in SELECT + `$2` in WHERE - `roundtrip_placeholder_typed_int64` — typed Int64 placeholder with proto-level `DynamicParameter` verification - `roundtrip_placeholder_multiple_typed` — two typed placeholders (Int64 + Decimal128) - `roundtrip_placeholder_typed_utf8` — Utf8 typed placeholder - `test_parse_placeholder_index` — unit test for index parsing edge cases All 190 integration tests, 28 unit tests, and 3 doc-tests pass. Clippy and fmt are clean. ## Are there any user-facing changes? Query plans containing `Placeholder` expressions can now be serialized to and deserialized from Substrait format. Previously this would return an error. -- 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]
