Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Applies to:
Databricks SQL
Databricks Runtime 10.4 LTS and above
Returns the absolute value of the numeric value in expr.
Syntax
abs(expr)
Arguments
expr: An expression that evaluates to a numeric or interval.
Returns
A numeric or interval of the same type as expr.
For integral numeric types the function can return an ARITHMETIC_OVERFLOW error.
Warning
In Databricks Runtime if spark.sql.ansi.enabled is false, an overflow does not cause an error but “wraps” the result instead.
Common error conditions
Examples
> SELECT abs(-1);
1
> SELECT abs(cast(-32768 AS SMALLINT));
Error: ARITHMETIC_OVERFLOW