adriangb opened a new issue, #26343:
URL: https://github.com/apache/datafusion/issues/26343
Since #25364, `TypeCoercion` calls `get_parameter_fields()` on every plan
and fails when one placeholder has two inferred types. A query that uses the
same placeholder where the SQL planner infers different types no longer plans,
even before any value is bound.
```rust
let ctx = SessionContext::new();
ctx.sql("CREATE TABLE t AS SELECT arrow_cast(now(), 'Timestamp(Microsecond,
Some(\"UTC\"))') AS ts").await?;
let state = ctx.state();
let plan = state
.create_logical_plan("SELECT ts FROM t WHERE ts >= $1 AND $1 =
date_bin(INTERVAL '1 minute', $1)")
.await?;
state.optimize(&plan)?;
```
Expected: the plan optimizes, as it did before #25364.
Actual:
```
type_coercion: Error during planning: Expected parameter of type
Timestamp(µs, "UTC"), got Timestamp(ns): Conflicting types for id $1
```
`ts >= $1` infers `Timestamp(µs, "UTC")` and `$1 = date_bin(..., $1)` infers
`Timestamp(ns)`. The conflict check makes sense for `PREPARE`, but it now also
rejects plain plans that bind values later with `replace_params_with_values`.
cc @1fanwang
--
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]