Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
ghx-label-3
Description
https://impala.incubator.apache.org/docs/build/html/topics/impala_conditional_functions.html mentions return types of nullifzero and zeroifnull:
nullifzero(numeric_expr)
Return type: same as the initial argument value, except that integer values are promoted to BIGINT and floating-point values are promoted to DOUBLE; use CAST() when inserting into a smaller numeric columnzeroifnull(numeric_expr)
Return type: same as the initial argument value, except that integer values are promoted to BIGINT and floating-point values are promoted to DOUBLE; use CAST() when inserting into a smaller numeric column
However, I see it returning the underlying type without promotion.
[...:21000] > select typeof(nullifzero(1)), typeof(zeroifnull(cast(1 as integer))); ... +-----------------------+------------------------------------+ | typeof(nullifzero(1)) | typeof(zeroifnull(cast(1 as int))) | +-----------------------+------------------------------------+ | TINYINT | INT | +-----------------------+------------------------------------+ Fetched 1 row(s) in 0.02s
I suspect the docs are wrong here.