You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Victoria Markman (JIRA)" <ji...@apache.org> on 2014/12/20 01:12:13 UTC
[jira] [Updated] (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:all-tabpanel ]
Victoria Markman updated DRILL-1903:
------------------------------------
Description:
{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}
was:
{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}
> 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
> Priority: Minor
>
> {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)