Volodymyr Vysotskyi created DRILL-6703: ------------------------------------------
Summary: Query with complex expressions in lateral and unnest fails with CannotPlanException Key: DRILL-6703 URL: https://issues.apache.org/jira/browse/DRILL-6703 Project: Apache Drill Issue Type: Bug Components: Query Planning & Optimization Affects Versions: 1.14.0 Reporter: Volodymyr Vysotskyi Assignee: Volodymyr Vysotskyi Fix For: 1.15.0 Queries like this: {code:sql} select l.name from cp.`lateraljoin/nested-customer.parquet` c, lateral (select u.item.i_name as name from unnest(c.orders[0].items) as u(item)) l limit 1 {code} fail with {{CannotPlanException}}: {noformat} 1:07:15.750 [2482e64c-9c2c-70b6-324e-848de16cb4c3:foreman] ERROR o.a.d.e.p.s.h.DefaultSqlHandler - Node [rel#142:Subset#8.LOGICAL.ANY([]).[]] could not be implemented; planner state: Root: rel#142:Subset#8.LOGICAL.ANY([]).[] Original rel: LogicalSort(subset=[rel#142:Subset#8.LOGICAL.ANY([]).[]], fetch=[1]): rowcount = 1.0, cumulative cost = {1.0 rows, 4.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 140 LogicalProject(subset=[rel#139:Subset#7.NONE.ANY([]).[]], name=[$2]): rowcount = 1.0, cumulative cost = {1.0 rows, 1.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 138 LogicalCorrelate(subset=[rel#137:Subset#6.NONE.ANY([]).[]], correlation=[$cor0], joinType=[inner], requiredColumns=[{1}]): rowcount = 1.0, cumulative cost = {inf}, id = 136 EnumerableTableScan(subset=[rel#126:Subset#0.ENUMERABLE.ANY([]).[]], table=[[cp, lateraljoin/nested-customer.parquet]]): rowcount = 100.0, cumulative cost = {100.0 rows, 101.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 9 LogicalProject(subset=[rel#135:Subset#5.NONE.ANY([]).[]], name=[ITEM($0, 'i_name')]): rowcount = 1.0, cumulative cost = {1.0 rows, 1.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 134 LogicalProject(subset=[rel#133:Subset#4.NONE.ANY([]).[]], item=[$0]): rowcount = 1.0, cumulative cost = {1.0 rows, 1.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 132 Uncollect(subset=[rel#131:Subset#3.NONE.ANY([]).[]]): rowcount = 1.0, cumulative cost = {1.0 rows, 1.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 130 LogicalProject(subset=[rel#129:Subset#2.NONE.ANY([]).[]], EXPR$0=[ITEM(ITEM($cor0.orders, 0), 'items')]): rowcount = 1.0, cumulative cost = {1.0 rows, 1.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 128 LogicalValues(subset=[rel#127:Subset#1.NONE.ANY([]).[0]], tuples=[[{ 0 }]]): rowcount = 1.0, cumulative cost = {1.0 rows, 1.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 10 {noformat} Due to the project from the right side of correlate, {{ProjectComplexRexNodeCorrelateTransposeRule}} cannot be applied, so later {{DrillUnnestRule}} cannot convert {{Uncollect}} with project with complex expressions to {{DrillUnnestRel}}. -- This message was sent by Atlassian JIRA (v7.6.3#76005)