You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Philip Zeyliger (JIRA)" <ji...@apache.org> on 2017/08/24 20:06:00 UTC

[jira] [Created] (IMPALA-5839) nullifzero and zeroifnull documentation about return type doesn't match implementation

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)