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

Decimal has an issue when used in case statement where the else expression contains a literal

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.4.0
    • Execution - Data Types
    • None

    Description

      git.commit.id.abbrev=e5c2da0

      The below query fails with an Assertion Error:

      select
      case
      when l_linestatus = 'Success' then l_extendedprice
      else 0
      end
      from lineitem;

      The source 'lineitem' is a view on top of a txt file. While creating the view when we change the type of l_extendedprice from decimal to double, this issue goes away. Below is the original view definition:

      create view lineitem as select cast(columns[0] as int) l_orderkey, cast(columns[1] as int) l_partkey, cast(columns[2] as int) l_suppkey, cast(columns[3] as int) l_linenumber, cast(columns[4] as decimal) l_quantity, cast(columns[5] as decimal) l_extendedprice, cast(columns[6] as decimal) l_discount, cast(columns[7] as decimal) l_tax, columns[8] l_returnflag, columns[9] l_linestatus, cast(columns[10] as date) l_shipdate, cast(columns[11] as date) l_commitdate, cast(columns[12] as date) l_receiptdate, columns[13] l_shipinstruct, columns[14] l_shipmode, columns[15] l_comment from `lineitem.tbl`;

      I also attached the log file along with the source data. Let me know if you have any questions

      Attachments

        1. error.log
          3 kB
          Rahul Kumar Challapalli
        2. lineitem.tbl
          3 kB
          Rahul Kumar Challapalli

        Activity

          People

            mehant Mehant Baid
            rkins Rahul Kumar Challapalli
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: