Ramana Inukonda Nagaraj created DRILL-1180:
----------------------------------------------

             Summary: Case messes up the datatype returned by function 
surrounding it
                 Key: DRILL-1180
                 URL: https://issues.apache.org/jira/browse/DRILL-1180
             Project: Apache Drill
          Issue Type: Bug
            Reporter: Ramana Inukonda Nagaraj
            Assignee: Mehant Baid
            Priority: Critical


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




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to