Oleksandr Chornyi created DRILL-6524:
----------------------------------------

             Summary: Two CASE statements in projection influence results of 
each other
                 Key: DRILL-6524
                 URL: https://issues.apache.org/jira/browse/DRILL-6524
             Project: Apache Drill
          Issue Type: Bug
          Components: Query Planning & Optimization
    Affects Versions: 1.11.0
         Environment: Linux 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 
19:03:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux,

NAME="CentOS Linux"
VERSION="7 (Core)"

apache drill 1.11.0, 

openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-b10)
OpenJDK 64-Bit Server VM (build 25.171-b10, mixed mode)
            Reporter: Oleksandr Chornyi


h3. Steps to Reproduce
Run the following query via {{sqlline}}:

{code:sql}
select
  case when expr$0 = 3 then expr$0 else expr$1 end,
  case when expr$0 = 1 then expr$0 else expr$1 end
from (values(1, 2));
{code}

h4. Actual Results

{noformat}
+---------+---------+
| EXPR$0  | EXPR$1  |
+---------+---------+
| 2       | 2       |
+---------+---------+
{noformat}

h4. Expected Results
{noformat}
+---------+---------+
| EXPR$0  | EXPR$1  |
+---------+---------+
| 2       | 1       |
+---------+---------+
{noformat}

Note, that changing order of CASE statements fixes the issue. The following 
query yields correct results:
{code:sql}
select
  case when expr$0 = 1 then expr$0 else expr$1 end,
  case when expr$0 = 3 then expr$0 else expr$1 end
from (values(1, 2));
{code}




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

Reply via email to