[ 
https://issues.apache.org/jira/browse/IMPALA-5839?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16553517#comment-16553517
 ] 

Alex Rodoni commented on IMPALA-5839:
-------------------------------------

https://gerrit.cloudera.org/#/c/11024/

> 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
>            Assignee: Alex Rodoni
>            Priority: Major
>
> 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
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to