drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Abhishek Girish (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DRILL-2747) Implicit cast in filters fails if enclosed literal has leading or trailing spaces
Date Fri, 10 Apr 2015 17:34:12 GMT

     [ https://issues.apache.org/jira/browse/DRILL-2747?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Abhishek Girish updated DRILL-2747:
-----------------------------------
    Description: 
Implicit cast in filters fail if literals contain leading or trailing spaces. 

*Drill:*
{code:sql}
> select d_date_sk, d_day_name from date_dim where d_date is not null and d_date between
'1900-01-10' and ' 1900-01-20'  limit 1 ;
+------------+------------+
| d_date_sk  | d_day_name |
+------------+------------+
+------------+------------+
No rows selected (0.221 seconds)
{code}

Prefixing the literal with "date" happens to solve the issue:
{code:sql}
> select d_date_sk, d_day_name from date_dim where d_date is not null and d_date between
date '1900-01-10' and date ' 1900-01-20'  limit 1 ;
+------------+------------+
| d_date_sk  | d_day_name |
+------------+------------+
| 2415030    | Tuesday    |
+------------+------------+
1 row selected (0.128 seconds)
{code}

*Postgres:*
{code:sql}
# select d_date_sk, d_day_name from date_dim where d_date is not null and d_date between '1900-01-10'
and ' 1900-01-20'  limit 1 ;
 d_date_sk | d_day_name
-----------+------------
   2415030 | Tuesday
(1 row)
{code}


  was:
Implicit cast in filters fail if literals contain trailing spaces. 

*Drill:*
{code:sql}
> select d_date_sk, d_day_name from date_dim where d_date is not null and d_date between
'1900-01-10' and ' 1900-01-20'  limit 1 ;
+------------+------------+
| d_date_sk  | d_day_name |
+------------+------------+
+------------+------------+
No rows selected (0.221 seconds)
{code}

Prefixing the literal with "date" happens to solve the issue:
{code:sql}
> select d_date_sk, d_day_name from date_dim where d_date is not null and d_date between
date '1900-01-10' and date ' 1900-01-20'  limit 1 ;
+------------+------------+
| d_date_sk  | d_day_name |
+------------+------------+
| 2415030    | Tuesday    |
+------------+------------+
1 row selected (0.128 seconds)
{code}

*Postgres:*
{code:sql}
# select d_date_sk, d_day_name from date_dim where d_date is not null and d_date between '1900-01-10'
and ' 1900-01-20'  limit 1 ;
 d_date_sk | d_day_name
-----------+------------
   2415030 | Tuesday
(1 row)
{code}



> Implicit cast in filters fails if enclosed literal has leading or trailing spaces
> ---------------------------------------------------------------------------------
>
>                 Key: DRILL-2747
>                 URL: https://issues.apache.org/jira/browse/DRILL-2747
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Query Planning & Optimization
>            Reporter: Abhishek Girish
>            Assignee: Jinfeng Ni
>
> Implicit cast in filters fail if literals contain leading or trailing spaces. 
> *Drill:*
> {code:sql}
> > select d_date_sk, d_day_name from date_dim where d_date is not null and d_date between
'1900-01-10' and ' 1900-01-20'  limit 1 ;
> +------------+------------+
> | d_date_sk  | d_day_name |
> +------------+------------+
> +------------+------------+
> No rows selected (0.221 seconds)
> {code}
> Prefixing the literal with "date" happens to solve the issue:
> {code:sql}
> > select d_date_sk, d_day_name from date_dim where d_date is not null and d_date between
date '1900-01-10' and date ' 1900-01-20'  limit 1 ;
> +------------+------------+
> | d_date_sk  | d_day_name |
> +------------+------------+
> | 2415030    | Tuesday    |
> +------------+------------+
> 1 row selected (0.128 seconds)
> {code}
> *Postgres:*
> {code:sql}
> # select d_date_sk, d_day_name from date_dim where d_date is not null and d_date between
'1900-01-10' and ' 1900-01-20'  limit 1 ;
>  d_date_sk | d_day_name
> -----------+------------
>    2415030 | Tuesday
> (1 row)
> {code}



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

Mime
View raw message