dqkqd opened a new pull request, #18286: URL: https://github.com/apache/datafusion/pull/18286
## Which issue does this PR close? - Closes #18102. ## 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 So I'm not quite sure should we fix it in `with_param_values`. ## 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. -- 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]
