Philip Zeyliger created IMPALA-5839:
---------------------------------------

             Summary: nullifzero and zeroifnull documentation about return type 
doesn't match implementation
                 Key: IMPALA-5839
                 URL: https://issues.apache.org/jira/browse/IMPALA-5839
             Project: IMPALA
          Issue Type: Bug
          Components: Docs
            Reporter: Philip Zeyliger


https://impala.incubator.apache.org/docs/build/html/topics/impala_conditional_functions.html
 mentions return types of {{nullifzero}} and {{zeroifnull}}:
{quote}
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 column

zeroifnull(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
{quote}

However, I see it returning the underlying type without promotion.
{code}
[...: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
{code}

I suspect the docs are wrong here.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to