hadrian-reppas commented on PR #23215:
URL: https://github.com/apache/datafusion/pull/23215#issuecomment-4822375801

   Also I realized that you have to check that the types match because 
otherwise reassociating the expression can change when casts happen which can 
change the answer if there is overflow. For example:
   ```
   > CREATE TABLE t(x INT);
   > INSERT INTO t(x) VALUES (1);
   > SELECT (x + CAST(1 AS TINYINT)) + CAST(127 AS TINYINT) FROM t;
   129
   > SELECT x + (CAST(1 AS TINYINT) + CAST(127 AS TINYINT)) FROM t;
   -127
   ```


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