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/16 17:39:38 UTC

[jira] [Commented] (DRILL-1903) Boolean column can't be used by itself in certain condition in a where clause

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

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

For the first failing query : select * from test where  c1;

I presume it is because c1 is ANY type at planning. So Calcite decides just not to let it go through!

> Boolean column can't be used by itself in certain condition in a where clause
> -----------------------------------------------------------------------------
>
>                 Key: DRILL-1903
>                 URL: https://issues.apache.org/jira/browse/DRILL-1903
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: SQL Parser
>    Affects Versions: 0.7.0
>            Reporter: Victoria Markman
>            Assignee: Jinfeng Ni
>            Priority: Minor
>             Fix For: 1.0.0
>
>
> {code}
> git.commit.id.abbrev=e3ab2c1
> {code}  
> {code}
> 0: jdbc:drill:schema=dfs> select * from test;
> +------------+------------+------------+
> |     a1     |     b1     |     c1     |
> +------------+------------+------------+
> | 0          | 0          | true       |
> | 0          | 0          | false      |
> | 0          | 0          | false      |
> | 1          | 1          | true       |
> | 1          | 1          | true       |
> +------------+------------+------------+
> 5 rows selected (0.067 seconds)
> 0: jdbc:drill:schema=dfs> select * from test where  c1;
> Query failed: Query failed: Failure validating SQL. org.eigenbase.util.EigenbaseContextException: From line 1, column 27 to line 1, column 28: WHERE clause must be a condition
> {code}
> However, all the cases below seem to work correctly:
> {code}0: jdbc:drill:schema=dfs> select * from test where 1=1 and c1;
> +------------+------------+------------+
> |     a1     |     b1     |     c1     |
> +------------+------------+------------+
> | 0          | 0          | true       |
> | 1          | 1          | true       |
> | 1          | 1          | true       |
> +------------+------------+------------+
> 3 rows selected (0.085 seconds)
> 0: jdbc:drill:schema=dfs> select * from test where c1 and 1=1;
> +------------+------------+------------+
> |     a1     |     b1     |     c1     |
> +------------+------------+------------+
> | 0          | 0          | true       |
> | 1          | 1          | true       |
> | 1          | 1          | true       |
> +------------+------------+------------+
> 3 rows selected (0.079 seconds)
> 0: jdbc:drill:schema=dfs> select * from test where not c1 and 1=1;
> +------------+------------+------------+
> |     a1     |     b1     |     c1     |
> +------------+------------+------------+
> | 0          | 0          | false      |
> | 0          | 0          | false      |
> +------------+------------+------------+
> 2 rows selected (0.095 seconds)
> 0: jdbc:drill:schema=dfs> select * from test where not c1;
> +------------+------------+------------+
> |     a1     |     b1     |     c1     |
> +------------+------------+------------+
> | 0          | 0          | false      |
> | 0          | 0          | false      |
> +------------+------------+------------+
> 2 rows selected (0.108 seconds)
> 0: jdbc:drill:schema=dfs> select * from test where c1 is true;
> +------------+------------+------------+
> |     a1     |     b1     |     c1     |
> +------------+------------+------------+
> | 0          | 0          | true       |
> | 1          | 1          | true       |
> | 1          | 1          | true       |
> +------------+------------+------------+
> 3 rows selected (0.093 seconds)
> 0: jdbc:drill:schema=dfs> select * from test where c1 is false;
> +------------+------------+------------+
> |     a1     |     b1     |     c1     |
> +------------+------------+------------+
> | 0          | 0          | false      |
> | 0          | 0          | false      |
> +------------+------------+------------+
> 2 rows selected (0.087 seconds)
> {code}



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