You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Sean Hsuan-Yi Chu (JIRA)" <ji...@apache.org> on 2015/03/05 22:43:38 UTC

[jira] [Commented] (DRILL-2313) Query fails when one of the operands is a DATE literal without an explicit cast

    [ https://issues.apache.org/jira/browse/DRILL-2313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14349500#comment-14349500 ] 

Sean Hsuan-Yi Chu commented on DRILL-2313:
------------------------------------------

`A between B and C` will be translated to B <= A and A<= C later on.

So we have pattern like this `A < B` with different types (not-Any type) will fail in the same manner.

Actually, constants (numbers & literals) causing pains sometimes. I am thinking if we can just treat numbers & literals as ANY types, and let execution logic deal with type things.

> Query fails when one of the operands is a DATE literal without an explicit cast
> -------------------------------------------------------------------------------
>
>                 Key: DRILL-2313
>                 URL: https://issues.apache.org/jira/browse/DRILL-2313
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Query Planning & Optimization
>    Affects Versions: 0.8.0
>            Reporter: Abhishek Girish
>            Assignee: Sean Hsuan-Yi Chu
>
> For operations involving the date datatype, when one of the operands is a DATE literal without a cast, query fails. 
> *The following query fails to validate:*
> {code:sql}
> SELECT
>          *
> FROM     
>          date_dim
>          
> WHERE    d_date BETWEEN '2002-3-01' AND cast('2002-3-01' AS DATE) 
> LIMIT 1;
> {code}
> Query failed: SqlValidatorException: Cannot apply 'BETWEEN' to arguments of type '<ANY> BETWEEN <CHAR(9)> AND <DATE>'. Supported form(s): '<COMPARABLE_TYPE> BETWEEN <COMPARABLE_TYPE> AND <COMPARABLE_TYPE>'
> *The following query executes fine:*
> {code:sql}
> SELECT
>          *
> FROM     
>          date_dim
>          
> WHERE    d_date BETWEEN '2002-3-01' AND 
>                   '2002-3-01'
> LIMIT 1;
> {code}
> Both the queries execute fine on postgres



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