viirya commented on PR #55938:
URL: https://github.com/apache/spark/pull/55938#issuecomment-4481678703

   PR description:
   
   > the eval path now produces the same SQL-formatted 
BINARY_ARITHMETIC_OVERFLOW error as the codegen path (the previous generic 
ArithmeticException was an inconsistency).
   
    This is wrong. Before this PR, the eval path for ANSI Byte goes:
     - nullSafeEval → case _ => numeric.plus(input1, input2) (line 461)
     - numeric is TypeUtils.getNumeric(dataType, failOnError=true) (line 442), 
which returns ByteExactNumeric
     - ByteExactNumeric.plus(x, y) (numerics.scala:33-37) computes tmp = x + y, 
then calls checkOverflow which throws
     QueryExecutionErrors.binaryArithmeticCauseOverflowError(x, "+", y, 
"try_add")
     
   That is the same call as the new helper, with the same error class 
BINARY_ARITHMETIC_OVERFLOW and identical message parameters. There was no 
generic ArithmeticException. Same for Short.
   
   So the new case _: ByteType if failOnError => 
ArithmeticUtils.byteAddExact(...) branches added to Add/Subtract/Multiply are 
redundant: they replace one route to the same error with a different route to 
the same error. Behaviorally identical.


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