[ 
https://issues.apache.org/jira/browse/KYLIN-3881?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zhong Yanghong updated KYLIN-3881:
----------------------------------
    Description: 
Sample SQLs:
{code}
select colA
       case
           when colB = (1 = 1) then 'B'
           when colC = (1 = 1) then 'C'
           when colD = (1 = 1) then 'D'
           else 'n/a'
       end as phase,
       count(*)
from T
where session_date between '2018-08-01' and '2018-08-31'
group by colA
       case
           when colB = (1 = 1) then 'B'
           when colC = (1 = 1) then 'C'
           when colD = (1 = 1) then 'D'
           else 'n/a'
       end;
{code}

{code}
select colA
       case
           when (colB = (1 = 1)) = (colC = (1 = 1)) then 'B&C'
           when (colC = (1 = 1)) = (colD = (1 = 1)) then 'C&D'
           else 'n/a'
       end as phase,
       count(*)
from T
where session_date between '2018-08-01' and '2018-08-31'
group by colA
       case
           when (colB = (1 = 1)) = (colC = (1 = 1)) then 'B&C'
           when (colC = (1 = 1)) = (colD = (1 = 1)) then 'C&D'
           else 'n/a'
       end;
{code}

> Kylin may return incorrect results when there's a CompareTupleFilter, like 
> colName = (1 = 1) 
> ---------------------------------------------------------------------------------------------
>
>                 Key: KYLIN-3881
>                 URL: https://issues.apache.org/jira/browse/KYLIN-3881
>             Project: Kylin
>          Issue Type: Bug
>            Reporter: Zhong Yanghong
>            Assignee: Zhong Yanghong
>            Priority: Major
>
> Sample SQLs:
> {code}
> select colA
>        case
>            when colB = (1 = 1) then 'B'
>            when colC = (1 = 1) then 'C'
>            when colD = (1 = 1) then 'D'
>            else 'n/a'
>        end as phase,
>        count(*)
> from T
> where session_date between '2018-08-01' and '2018-08-31'
> group by colA
>        case
>            when colB = (1 = 1) then 'B'
>            when colC = (1 = 1) then 'C'
>            when colD = (1 = 1) then 'D'
>            else 'n/a'
>        end;
> {code}
> {code}
> select colA
>        case
>            when (colB = (1 = 1)) = (colC = (1 = 1)) then 'B&C'
>            when (colC = (1 = 1)) = (colD = (1 = 1)) then 'C&D'
>            else 'n/a'
>        end as phase,
>        count(*)
> from T
> where session_date between '2018-08-01' and '2018-08-31'
> group by colA
>        case
>            when (colB = (1 = 1)) = (colC = (1 = 1)) then 'B&C'
>            when (colC = (1 = 1)) = (colD = (1 = 1)) then 'C&D'
>            else 'n/a'
>        end;
> {code}



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

Reply via email to