drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Victoria Markman (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DRILL-2084) Order by on date, time, timestamp and boolean columns produces wrong results if column contains null values
Date Tue, 27 Jan 2015 20:06:35 GMT
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:
create table t1(c_varchar, c_integer, c_bigint, c_smalldecimal, c_bigdecimal, c_float, c_date,
c_time, c_timestamp, c_boolean) as
        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)
        case when columns[2] = '' then cast(null as bigint) else cast(columns[2] as bigint)
        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)
        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)
        case when columns[9] = '' then cast(null as boolean) else cast(columns[9] as boolean)
from `t1.csv`;

Failing queries are:
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;

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

This message was sent by Atlassian JIRA

View raw message