Khurram Faraaz created DRILL-4937:
-------------------------------------
Summary: AND of <INTEGER> AND <BOOLEAN> should fail
Key: DRILL-4937
URL: https://issues.apache.org/jira/browse/DRILL-4937
Project: Apache Drill
Issue Type: Bug
Components: Execution - Data Types
Affects Versions: 1.9.0
Reporter: Khurram Faraaz
Drill 1.9.0 git commit id : 4edabe7a
Calcite returns an error
{noformat}
0: jdbc:calcite:model=target/test-classes/mod> select * from emps where 1 = (
case when empno=99 and empno in (1,6,99,100) then 1 when coalesce (empno,0) and
empno in(empno) then 1 else 0 end);
Error: Error while executing SQL "select * from emps where 1 = ( case when
empno=99 and empno in (1,6,99,100) then 1 when coalesce (empno,0) and empno
in(empno) then 1 else 0 end)": From line 1, column 89 to line 1, column 126:
Cannot apply 'AND' to arguments of type '<INTEGER> AND <BOOLEAN>'. Supported
form(s): '<BOOLEAN> AND <BOOLEAN>' (state=,code=0)
0: jdbc:calcite:model=target/test-classes/mod>
{noformat}
Postgres 9.3 returns similar error
{noformat}
postgres=# select * from emp_tbl where 1 = ( case when id=99 and id in
(1,6,99,100) then 1 when coalesce (id,0) and id in(id) then 1 else 0 end);
ERROR: argument of AND must be type boolean, not type integer
LINE 1: ...ase when id=99 and id in (1,6,99,100) then 1 when coalesce (...
{noformat}
^
Drill 1.9.0 returns results for same query
{noformat}
0: jdbc:drill:schema=dfs.tmp> select * from `emp_tbl` where 1 = ( case when
id=99 and id in (1,6,99,100) then 1 when coalesce (id,0) and id in(id) then 1
else 0 end);
+-----+-----------+------+--------+----------+
| id | name | age | state | salary |
+-----+-----------+------+--------+----------+
| 1 | John Doe | 51 | AZ | 1000000 |
+-----+-----------+------+--------+----------+
1 row selected (0.148 seconds)
{noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)