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

Victoria Markman commented on DRILL-2152:
-----------------------------------------

Yes, these queries are supported now and we do have tests for them (including 
queries that throw errors)

Unsupported operation exception:
{code}
0: jdbc:drill:schema=dfs> select * from t1 where a1 < ( select a2 from t2 limit 
1 );
Error: UNSUPPORTED_OPERATION ERROR: This query cannot be planned possibly due 
to either a cartesian join or an inequality join
[Error Id: f819cc3b-4aef-477d-a251-7d71dae75449 on atsqa4-133.qa.lab:31010] 
(state=,code=0)
{code}

This query works now:
{code}
0: jdbc:drill:schema=dfs> select * from t1 where a1 < ( select max(a2) from t2);
+-----+--------+-------------+
| a1  |   b1   |     c1      |
+-----+--------+-------------+
| 1   | aaaaa  | 2015-01-01  |
| 2   | bbbbb  | 2015-01-02  |
| 3   | ccccc  | 2015-01-03  |
| 4   | null   | 2015-01-04  |
| 5   | eeeee  | 2015-01-05  |
| 6   | fffff  | 2015-01-06  |
| 7   | ggggg  | 2015-01-07  |
+-----+--------+-------------+
7 rows selected (1.997 seconds)
{code}

However, I just found one more case where we failed to return correct error.
First query should throw the same exception as the second one:
{code}
0: jdbc:drill:schema=dfs> select * from t1 where (a1, b1) = ( select a2, b2 
from t2);
Error: PARSE ERROR: From line 1, column 37 to line 1, column 57: Cannot apply 
'$SCALAR_QUERY' to arguments of type '$SCALAR_QUERY(<RECORDTYPE(ANY A2, ANY 
B2)>)'. Supported form(s): '$SCALAR_QUERY(<RECORDTYPE(SINGLE FIELD)>)'
[Error Id: ec158031-dbbb-4a84-bd04-615f806dc9d2 on atsqa4-133.qa.lab:31010] 
(state=,code=0)

0: jdbc:drill:schema=dfs> select * from t1 where a1 = ( select a2 from t2);
Error: UNSUPPORTED_OPERATION ERROR: Non-scalar sub-query used in an expression
See Apache Drill JIRA: DRILL-1937
[Error Id: db70881f-0b26-47ed-8c69-ee63c25bb260 on atsqa4-133.qa.lab:31010] 
(state=,code=0)
{code}

Reopening this bug for fixing this case.


> Scalar Subqueries error message should be friendly
> --------------------------------------------------
>
>                 Key: DRILL-2152
>                 URL: https://issues.apache.org/jira/browse/DRILL-2152
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Query Planning & Optimization
>            Reporter: Jacques Nadeau
>            Assignee: Sean Hsuan-Yi Chu
>             Fix For: 1.2.0
>
>




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

Reply via email to