[ https://issues.apache.org/jira/browse/DRILL-7050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16905219#comment-16905219 ]
benj commented on DRILL-7050: ----------------------------- Just to illustrate in a real case (simplified here) the problem pointed by [~le.louch]: It's possible to do {code:sql} SELECT u FROM (SELECT split(r,' ') AS r FROM (SELECT 'unnest is useful' AS r)) AS x ,LATERAL(SELECT $unnest AS u FROM unnest(x.r)) => +-----------+ | u | +-----------+ | unnest | | is | | useful | +-----------+ {code} but not possible to do {code:sql} SELECT t, (SELECT count(*) FROM (SELECT split(r,' ') AS r FROM (SELECT sub.t AS r)) AS x ,LATERAL(SELECT $unnest AS u FROM unnest(x.r)) /* WHERE ... */) t2 FROM (SELECT 'unnest is useful' AS t) sub => Error: SYSTEM ERROR: UnsupportedOperationException: Adding Implicit RowID column is not supported for ValuesPrel operator {code} > 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.14.0, 1.15.0 > Reporter: Oleg Zinoviev > Assignee: Volodymyr Vysotskyi > Priority: Major > Labels: ready-to-commit > Fix For: 1.17.0 > > > 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) > {code:sql} > create table dfs.root.source as ( > select 1 as id union all select 2 as id > ) > {code} > 2) Execute query > {code:sql} > select t1.id, > (select count(t2.id) > from dfs.root.source t2 where t2.id = t1.id) > from dfs.root.source t1 > {code} > Reason: > Method > {code:java}org.apache.calcite.sql2rel.SqlToRelConverter.Blackboard.lookupExp{code} > call {code:java}RexBuilder.makeCorrel{code} in some cases -- This message was sent by Atlassian JIRA (v7.6.14#76016)