liukun4515 commented on PR #3254:
URL: 
https://github.com/apache/arrow-datafusion/pull/3254#issuecomment-1239345990

   > > > After the refactor of the type coercion, do we need to forbid to 
creation of physical expr directly?
   > > 
   > > 
   > > I would personally prefer allow creating PhysicalExprs but not providing 
automatic coercion (leaving it up to the user to use the proper types)
   > 
   > A+B will get the common data type `C` in the logical phase, but it will 
also affected in the physical phase. C+C will convert the D data type, but I 
can't find this changes after this #3222 merged. I want to find out why
   
   I think I find a bug 
https://github.com/apache/arrow-datafusion/blob/c359018baa8bbb0a227e83df948c903cde4d701f/datafusion/expr/src/binary_rule.rs#L293
 for the type coercion in arithmetic op.
   
   @andygrove  @alamb 
   
   If we move the type coercion to the logical phase, the type coercion will 
apply the binary op twice.
   For the arithmetic operation, the decimal128(10,0) + decimal128(10,0) will 
get decimal128(11,0).
   If the rule was applied to the op twice, the result type should be 
decimal(12,0);
   
   


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

Reply via email to