davisp opened a new issue, #13678:
URL: https://github.com/apache/datafusion/issues/13678
### Describe the bug
Calling `LogicalPlan::get_parameter_types()` does not return the place
holder from `SELECT $1;`.
### To Reproduce
The assertion triggers because no parameters are returned.
```rust
use datafusion::error::Result;
use datafusion::prelude::*;
#[tokio::main]
async fn main() -> Result<()> {
let ctx = SessionContext::new();
let plan = ctx.state().create_logical_plan("SELECT $1;").await?;
let params = plan.get_parameter_types()?;
assert_eq!(params.len(), 1);
Ok(())
}
```
### Expected behavior
All placeholders are returned.
### Additional context
There appears to be a builtin assumption that `get_parameter_types` only
returns placeholders that have a resolved type while filtering out anything
with a `None` data_type:
https://github.com/apache/datafusion/blob/fc703238b1d7794bd132a7fb6b97cad9ba4c7446/datafusion/expr/src/logical_plan/plan.rs#L1485-L1496
I can't decide if that's a valid assumption or was just a left over from
when things were relying on Placeholders to always have a resolved datatype.
Given that the function signature is `HashMap<String, Option<DataType>>` but
values are guaranteed to always be `Some`, I'm just plain confused.
--
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]