drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Khurram Faraaz (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DRILL-3664) CAST integer zero and one to boolean false and true
Date Tue, 18 Aug 2015 17:37:45 GMT
Khurram Faraaz created DRILL-3664:
-------------------------------------

             Summary: CAST integer zero and one to boolean false and true
                 Key: DRILL-3664
                 URL: https://issues.apache.org/jira/browse/DRILL-3664
             Project: Apache Drill
          Issue Type: Bug
          Components: SQL Parser
    Affects Versions: 1.2.0
            Reporter: Khurram Faraaz
            Assignee: Aman Sinha


We should be able to cast (zero) 0 to false and (one) 1 to true, currently we report a parse
error when an explicit cast is used in query.

col7 is of type Boolean in the below input parquet file.

{code}
0: jdbc:drill:schema=dfs.tmp> select col7 from FEWRWSPQQ_101 where col7 IN (cast(0 as boolean),cast(1
as boolean));
Error: PARSE ERROR: From line 1, column 47 to line 1, column 64: Cast function cannot convert
value of type INTEGER to type BOOLEAN


[Error Id: d751945f-8a0f-4369-ae9e-c42504f6d978 on centos-04.qa.lab:31010] (state=,code=0)
{code}

Without explicit cast we see SchemaChangeException.

{code}
0: jdbc:drill:schema=dfs.tmp> select col7 from FEWRWSPQQ_101 where col7 IN (0,1);
Error: SYSTEM ERROR: SchemaChangeException: Failure while trying to materialize incoming schema.
 Errors:
 
Error in expression at index -1.  Error: Missing function implementation: [castINT(BIT-OPTIONAL)].
 Full expression: --UNKNOWN EXPRESSION--.
Error in expression at index -1.  Error: Missing function implementation: [castINT(BIT-OPTIONAL)].
 Full expression: --UNKNOWN EXPRESSION--..

Fragment 0:0

[Error Id: ecf51dae-62c5-40d7-b0f5-3b9bf9fd3377 on centos-04.qa.lab:31010] (state=,code=0)
{code}

Postgres results for the same query.

{code}
postgres=# select col7 from FEWRWSPQQ_101 where col7 IN (cast(0 as boolean),cast(1 as boolean));
 col7 
------
 f
 t
 f
 t
 f
 t
 f
 t
 f
 t
 f
 t
 f
 t
 f
 t
 f
 t
 f
 t
 f
 t
(22 rows)
{code}



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

Mime
View raw message