[
https://issues.apache.org/jira/browse/HIVE-14206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15412387#comment-15412387
]
Barna Zsombor Klara commented on HIVE-14206:
--------------------------------------------
Hi [~sfotiadis]
could you confirm which hive version you are running this query against?
When I tried to run this on the master branch:
{code}
select
(case when 1=sum(1) then true else false end) bool_true,
(case when 1=sum(0) then true else false end) bool_false,
(case when 1=(1+null) then true else false end) bool_null,
(case when 1=sum(1+null) then true else false end) bool_null_sum,
(case when 1=sum(1) then 'true' else 'false' end) string_true,
(case when 1=sum(0) then 'true' else 'false' end) string_false,
(case when 1=(1+null) then 'true' else 'false' end) string_null,
(case when 1=sum(1+null) then 'true' else 'false' end) string_null_sum;
{code}
I got these results:
|| bool_true || bool_false || bool_null || bool_null_sum || string_true ||
string_false || string_null || string_null_sum ||
| true | false | false | false | true | false
| false | false |
> CASE boolean output is NULL when SUM condition statement returns NULL
> ---------------------------------------------------------------------
>
> Key: HIVE-14206
> URL: https://issues.apache.org/jira/browse/HIVE-14206
> Project: Hive
> Issue Type: Bug
> Reporter: Stathis Fotiadis
> Priority: Critical
>
> This query
> {code:sql}
> select
> case when 1=sum(1) then true else false end) bool_true,
> (case when 1=sum(0) then true else false end) bool_false,
> (case when 1=(1+null) then true else false end) bool_null,
> (case when 1=sum(1+null) then true else false end) bool_null_sum,
> (case when 1=sum(1) then 'true' else 'false' end) string_true,
> (case when 1=sum(0) then 'true' else 'false' end) string_false,
> (case when 1=(1+null) then 'true' else 'false' end) string_null,
> (case when 1=sum(1+null) then 'true' else 'false' end) string_null_sum
> {code}
> results to
> ||bool_true||bool_false||bool_null||
> bool_null_sum||string_true||string_false||string_null||string_null_sum||
> |true|false|false|NULL|true|false|false|false|
> First of all the is the inconsistency between (1+null) and SUM(1+null) and
> secondly the inconsistency between using boolean and string output
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)