You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by "Victoria Markman (JIRA)" <ji...@apache.org> on 2015/01/27 21:06:35 UTC

[jira] [Created] (DRILL-2084) Order by on date, time, timestamp and boolean columns produces wrong results if column contains null values

Victoria Markman created DRILL-2084:
---------------------------------------

             Summary: Order by on date, time, timestamp and boolean columns produces wrong results if column contains null values
                 Key: DRILL-2084
                 URL: https://issues.apache.org/jira/browse/DRILL-2084
             Project: Apache Drill
          Issue Type: Bug
          Components: Execution - Data Types
    Affects Versions: 0.8.0
            Reporter: Victoria Markman
            Assignee: Daniel Barclay (Drill/MapR)


Nulls are neither sorted at the end or beginning of the table, they appear in the middle.
I created table using parquet format from t1.csv file.

Here is create table statement I used to create table that is used in the queries:
{code}
create table t1(c_varchar, c_integer, c_bigint, c_smalldecimal, c_bigdecimal, c_float, c_date, c_time, c_timestamp, c_boolean) as
select
        case when columns[0] = '' then cast(null as varchar(255)) else cast(columns[0] as varchar(255)) end,
        case when columns[1] = '' then cast(null as integer) else cast(columns[1] as integer) end,
        case when columns[2] = '' then cast(null as bigint) else cast(columns[2] as bigint) end,
        case when columns[3] = '' then cast(null as decimal(18,4)) else cast(columns[3] as decimal(18, 4)) end,
        case when columns[4] = '' then cast(null as decimal(38,4)) else cast(columns[4] as decimal(38, 4)) end,
        case when columns[5] = '' then cast(null as float) else cast(columns[5] as float) end,
        case when columns[6] = '' then cast(null as date) else cast(columns[6] as date) end,
        case when columns[7] = '' then cast(null as time) else cast(columns[7] as time) end,
        case when columns[8] = '' then cast(null as timestamp) else cast(columns[8] as timestamp) end,
        case when columns[9] = '' then cast(null as boolean) else cast(columns[9] as boolean) end
from `t1.csv`;
{code}

Failing queries are:
{code}
select c_date from t1 order by c_date;
select c_time from t1 order by c_time;
select c_timestamp from t1 order by c_timestamp;
select c_boolean from t1 order by c_boolean;
{code}

If you add 'IS NULL' or 'IS NOT NULL' predicates to the queries above, you will get correct results.
I will attach all the relevant files to this bug.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)