With ANSI mode set, ceiling and floor saturate to LONG_MAX/LONG_MIN on overflow instead of throwing. This is in contrast to e.g. abs which throws on overflow.
Steps to reproduce:
-- throws as specified in the docs
SELECT abs(-2147483648);
-- should throw but saturates to 9223372036854775807
SELECT ceiling(1e30);
-- should throw but saturates to -9223372036854775808
SELECT floor(-1e30);
Expected: SparkArithmeticException: ARITHMETIC_OVERFLOW
Actual: 9223372036854775807 / -9223372036854775808
With ANSI mode set,
ceilingandfloorsaturate toLONG_MAX/LONG_MINon overflow instead of throwing. This is in contrast to e.g.abswhich throws on overflow.Steps to reproduce: