[
https://issues.apache.org/jira/browse/DRILL-1180?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mehant Baid updated DRILL-1180:
-------------------------------
Attachment: DRILL-1180.patch
This patch can be independently merged into drill without breaking any tests,
but part of the bug fix is also in Optiq, pull request:
https://github.com/jacques-n/optiq/pull/10
> 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
> Fix For: 0.4.0
>
> Attachments: DRILL-1180.patch
>
>
> 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)