You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: with_param_values on LogicalPlan::EmptyRelation returns incorrect schema (#18286)
## Which issue does this PR close?
- Part of #18102.
This only resolves for `LogicalPlan::EmptyRelation`.
## Rationale for this change
`with_param_values` doesn't substitute params' type if it is used on
`EmptyRelation`.
Thus, causing `SELECT $1, $2` to have incorrect schema after
substitution.
For example: after replacing `$1 = 1, $2 = "s"`, the schema is `[Null,
Null]`, but it should
be `[Int64, Utf8]`.
This schema type mismatch is resolved before converting to physical plan
by
the `type_coercion` rule in the `analyzer`.
https://github.com/apache/datafusion/blob/814236093c4045bb3d972e4c1124727229743ed9/datafusion/optimizer/src/analyzer/type_coercion.rs#L149
## What changes are included in this PR?
- recompute the schema after replacing param values.
## Are these changes tested?
Yes.
## Are there any user-facing changes?
No.
0 commit comments