drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jinfeng Ni (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DRILL-5683) Incorrect query result when query uses NOT(IS NOT NULL) expression
Date Thu, 20 Jul 2017 23:25:00 GMT
Jinfeng Ni created DRILL-5683:
---------------------------------

             Summary: Incorrect query result when query uses NOT(IS NOT NULL) expression 
                 Key: DRILL-5683
                 URL: https://issues.apache.org/jira/browse/DRILL-5683
             Project: Apache Drill
          Issue Type: Bug
            Reporter: Jinfeng Ni


The following repo was modified from a testcase provided by Arjun Rajan(arajan@mapr.com).

1. Prepare dataset with null.

{code}
create table dfs.tmp.t1 as select r_regionkey, r_name, case when mod(r_regionkey, 3) >
0 then mod(r_regionkey, 3) else null end as flag from cp.`tpch/region.parquet`;

select * from dfs.tmp.t1;
+--------------+--------------+-------+
| r_regionkey  |    r_name    | flag  |
+--------------+--------------+-------+
| 0            | AFRICA       | null  |
| 1            | AMERICA      | 1     |
| 2            | ASIA         | 2     |
| 3            | EUROPE       | null  |
| 4            | MIDDLE EAST  | 1     |
+--------------+--------------+-------+
{code}

2. Query with NOT(IS NOT NULL) expression in the filter. 
{code}
select * from dfs.tmp.t1 where NOT (flag IS NOT NULL);

+--------------+---------+-------+
| r_regionkey  | r_name  | flag  |
+--------------+---------+-------+
| 0            | AFRICA  | null  |
| 3            | EUROPE  | null  |
+--------------+---------+-------+
{code}

3. Switch run-time code compiler from default to 'JDK', and get wrong result. 
{code}
alter system set `exec.java_compiler` = 'JDK';

+-------+------------------------------+
|  ok   |           summary            |
+-------+------------------------------+
| true  | exec.java_compiler updated.  |
+-------+------------------------------+

select * from dfs.tmp.t1 where NOT (flag IS NOT NULL);
+--------------+--------------+-------+
| r_regionkey  |    r_name    | flag  |
+--------------+--------------+-------+
| 0            | AFRICA       | null  |
| 1            | AMERICA      | 1     |
| 2            | ASIA         | 2     |
| 3            | EUROPE       | null  |
| 4            | MIDDLE EAST  | 1     |
+--------------+--------------+-------+
{code}

4.  Wrong result could happen too, when NOT(IS NOT NULL) in Project operator.
{code}
select r_regionkey, r_name, NOT(flag IS NOT NULL) as exp1 from dfs.tmp.t1;
+--------------+--------------+-------+
| r_regionkey  |    r_name    | exp1  |
+--------------+--------------+-------+
| 0            | AFRICA       | true  |
| 1            | AMERICA      | true  |
| 2            | ASIA         | true  |
| 3            | EUROPE       | true  |
| 4            | MIDDLE EAST  | true  |
+--------------+--------------+-------+
{code}




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message