pepijnve commented on PR #19321:
URL: https://github.com/apache/datafusion/pull/19321#issuecomment-3660590063

   > It makes sense, but I think its fine to use the first type as the hint for 
the placeholders - as long as it can be coerced into the unified type when the 
placeholders are assigned.
   
   Does this introduce the possibility of deriving too strict a type? In the 
current implementation for this example somewhere along the return type is 
derived to be `float32`. Does this type inference happen before or after that? 
In the case it happens before, the type of the placeholder would be set to 
`int64` while you might want it to be `float32` instead.
   
   ```
   > explain select case a when 0 then ? when 1 then 1::bigint else 2::real end 
from values (0),(1),(2) t(a);
   
+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | plan_type           | plan                                                 
                                                                                
                                                       |
   
+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | logical_plan        | Projection: CASE t.a WHEN Int64(0) THEN CAST(? AS 
Float32) WHEN Int64(1) THEN Float32(1) ELSE Float32(2) END AS CASE t.a WHEN 
Int64(0) THEN ? WHEN Int64(1) THEN Int64(1) ELSE Int64(2) END |
   |                     |   SubqueryAlias: t                                   
                                                                                
                                                       |
   |                     |     Projection: column1 AS a                         
                                                                                
                                                       |
   |                     |       Values: (Int64(0)), (Int64(1)), (Int64(2))     
                                                                                
                                                       |
   | physical_plan_error | Execution error: Placeholder '?' was not provided a 
value for execution.                                                            
                                                        |
   
+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   ```


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