You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Zoltan Haindrich (JIRA)" <ji...@apache.org> on 2016/09/01 00:20:20 UTC

[jira] [Commented] (HIVE-13555) Add nullif udf

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

Zoltan Haindrich commented on HIVE-13555:
-----------------------------------------

i've checked for reference postgresql's nullif...it converts types like:
{code}
 nullif(integer,integer) => integer
 nullif(text,integer) => integer
 nullif(integer,text) => integer
 nullif(text,text) => text
{code}
it demotes the the text argument into integer - in case the otherone is an integer...and produces a syntax exception for nullif(1,'x') 

the proposed method will keep the 'first' argument type, but will convert the second if needed...in case someone puts in a string...this is good or bad?
i think this is somewhat expected...and will align with 'case when' current implementation.
should I remove the conversion - be strict about types as much as possible - and stick to the standard?


> Add nullif udf
> --------------
>
>                 Key: HIVE-13555
>                 URL: https://issues.apache.org/jira/browse/HIVE-13555
>             Project: Hive
>          Issue Type: Sub-task
>          Components: UDF
>            Reporter: Ashutosh Chauhan
>            Assignee: Zoltan Haindrich
>         Attachments: HIVE-13555.1.patch
>
>
> {{nullif(exp1, exp2)}} is shorthand for: {{case when exp1 = exp2 then null else exp1}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)