1fanwang commented on code in PR #25364:
URL: https://github.com/apache/datafusion/pull/25364#discussion_r4175257441


##########
datafusion/optimizer/src/analyzer/type_coercion.rs:
##########
@@ -355,6 +355,14 @@ impl<'a> TypeCoercionRewriter<'a> {
             schema: &DFSchema,
             expr_name: &str,
         ) -> Result<Expr> {
+            // An untyped placeholder has no type to coerce yet. Leave it bare 
so
+            // `LogicalPlan::get_parameter_fields` can still default it to 
Int64
+            // post-analysis; wrapping it in a `CAST` here would hide it from 
that
+            // inference because the cast's inner expression is no longer a
+            // top-level `Limit` operand.
+            if matches!(&expr, Expr::Placeholder(p) if p.field.is_none()) {

Review Comment:
   Fixed in 
https://github.com/apache/datafusion/commit/b66d80b1fd35a526ac3f792dc3bc43a3013b773c.
 TypeCoercion still casts LIMIT/OFFSET operands to Int64; get_parameter_fields 
now sees through that implicit cast when applying the row-count default, while 
preserving an Int32 type inferred from another use. The analyzer-bind-optimizer 
regression and PREPARE/EXECUTE case pass.



-- 
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]

Reply via email to