normanj-bitquill commented on PR #3942:
URL: https://github.com/apache/calcite/pull/3942#issuecomment-2327594970

   > I don't really understand why the result for TINYINT will be correct, 
since today Calcite incorrectly does not truncate the results for short 
arithmetic.
   
   @mihaibudiu I have created a custom `SqlReturnTypeInference` class. It will 
look at the arguments and choose the largest integer type (if both are integer 
types), otherwise use the type of the first argument. If both arguments are 
`NULL`, then just assume integer nullable return type.
   
   Perhaps you mean when the result of the BITAND is converted from a long back 
to a TINYINT. If this is the case, do you have any examples where it fails to 
truncate the value correctly? No truncation should be needed, since the result 
cannot exceed the largest argument type.


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