Oleg Zinoviev created DRILL-7050:
------------------------------------

             Summary: RexNode convert exception in subquery
                 Key: DRILL-7050
                 URL: https://issues.apache.org/jira/browse/DRILL-7050
             Project: Apache Drill
          Issue Type: Bug
    Affects Versions: 1.15.0, 1.14.0
            Reporter: Oleg Zinoviev


If the query contains a subquery whose filters are associated with the main 
query, an error occurs: ```PLAN ERROR: Cannot convert RexNode to equivalent 
Drill expression. RexNode Class: org.apache.calcite.rex.RexCorrelVariable```

Steps to reproduce:
1) Create source table (or view, doesn't matter)
```sql
create table dfs.root.source as  (
    select 1 as id union all select 2 as id
)
```
2) Execute query
```sql
select t1.id,
        (select count(t2.id) 
        from storage.datasets.source t2 where t2.id = t1.id)
from storage.datasets.source t1
```

Reason: 

Method ```org.apache.calcite.sql2rel.SqlToRelConverter.Blackboard.lookupExp```  
call ```RexBuilder.makeCorrel``` in some cases




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to