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

Case messes up the datatype returned by function surrounding it

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • None
    • 0.4.0
    • None
    • None

    Description

      Hit this while investigating tpch data variation between postgres and drill
      Simplified tpch14 to the following query:

      select
      sum(case
      when l.L_RETURNFLAG like 'R%'
      then l.l_extendedprice * (1 - l.l_discount)
      else 0
      end)
      from lineitem l;

      returns bigint in the case of drill and double in the case of postgres. Extendedprice and discount are double though.

      Drill:507996494
      Postgres:507996454.406699

      However when the case is removed and we use an equivalent filter instead drill and postgres return the same results:

      select
      sum(l.l_extendedprice * (1 - l.l_discount)
      from lineitem l where l.L_RETURNFLAG like 'R%';

      Postgres: 507996454.406699
      Drill: 5.0799645440669966E8

      This would explain the data mismatch for both TPCH14 and 8

      git.commit.id.abbrev=e5c2da0

      Attachments

        1. DRILL-1180.patch
          35 kB
          Mehant Baid

        Activity

          People

            DrillCommitter DrillCommitter
            inramana Ramana Inukonda Nagaraj
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: