Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-6524

Two CASE statements in projection influence results of each other

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.11.0
    • 1.16.0

    Description

      Steps to Reproduce

      Run the following query via sqlline:

      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));
      

      Actual Results

      +---------+---------+
      | EXPR$0  | EXPR$1  |
      +---------+---------+
      | 2       | 2       |
      +---------+---------+
      

      Expected Results

      +---------+---------+
      | EXPR$0  | EXPR$1  |
      +---------+---------+
      | 2       | 1       |
      +---------+---------+
      

      Note, that changing order of CASE statements fixes the issue. The following query yields correct results:

      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));
      

      Attachments

        Issue Links

          Activity

            People

              volodymyr Vova Vysotskyi
              pseudochaos Oleksandr Chornyi
              Vitalii Diravka Vitalii Diravka
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: