You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Vineet Garg (JIRA)" <ji...@apache.org> on 2018/08/16 22:49:00 UTC

[jira] [Comment Edited] (HIVE-20406) Nested Coalesce giving incorrect results

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

Vineet Garg edited comment on HIVE-20406 at 8/16/18 10:48 PM:
--------------------------------------------------------------

COALESCE(null) is typed void and during constant folding JavaVoidObjectInspector.getPrimitiveWritableObject is called which in turn calls NullWritable.get() to get to the object (null here) value. For some reason it ends up returning {{(null)}} instead of {{null}}. Therefore coalesce ends up returning this "supposedly" non null value.


was (Author: vgarg):
COALESCE(null) is typed void and during constant folding JavaVoidObjectInspector.getPrimitiveWritableObject is called which in turn calls NullWritable.get() to get to the object (null here) value. For some reason it ends up returning {{(null)}} instead of {null}. Therefore coalesce ends up returning this "supposedly" non null value.

> Nested Coalesce giving incorrect results
> ----------------------------------------
>
>                 Key: HIVE-20406
>                 URL: https://issues.apache.org/jira/browse/HIVE-20406
>             Project: Hive
>          Issue Type: Bug
>          Components: CBO
>    Affects Versions: 3.0.0
>            Reporter: Riju Trivedi
>            Assignee: Vineet Garg
>            Priority: Critical
>         Attachments: HIVE-20406.1.patch
>
>
> Below query is returning NULL instead of 'TEST' 
> select coalesce(coalesce(null), 'TEST');
> {noformat}
> INFO  : OK
> +-------+
> |  _c0  |
> +-------+
> | NULL  |
> +-------+
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)