Max Gekk created SPARK-62300:
--------------------------------

             Summary: Suggest try_abs and try_negative in the overflow errors 
of abs, negative and the unary minus
                 Key: SPARK-62300
                 URL: https://issues.apache.org/jira/browse/SPARK-62300
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 5.0.0
            Reporter: Max Gekk


Under ANSI mode, the overflow errors of +, - and * suggest try_add, 
try_subtract and try_multiply ("Use 'try_add' to tolerate overflow and return 
NULL instead."). The overflow errors of abs, negative and the unary minus 
suggest nothing, since MathUtils.negateExact (Byte/Short/Int/Long) and 
IntervalMathUtils.negateExact pass no hint. For example, SELECT 
abs(-2147483648) under ANSI mode gives only:

[ARITHMETIC_OVERFLOW] integer overflow. If necessary set spark.sql.ansi.enabled 
to "false" to bypass this error.

SPARK-62149 adds try_abs and try_negative, which return NULL there. The 
overflow errors of abs should suggest try_abs, and those of negative and the 
unary minus try_negative. Abs and UnaryMinus share MathUtils.negateExact, so 
each needs its own hint. The golden files that show these errors need to be 
regenerated.

Raised in the review of https://github.com/apache/spark/pull/60769.




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to