You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/08/23 09:46:00 UTC

[jira] [Commented] (DRILL-6703) Query with complex expressions in lateral and unnest fails with CannotPlanException

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

ASF GitHub Bot commented on DRILL-6703:
---------------------------------------

vvysotskyi opened a new pull request #1441: DRILL-6703: Query with complex expressions in lateral and unnest fails with CannotPlanException
URL: https://github.com/apache/drill/pull/1441
 
 
   Initially to handle unnest with complex calls was introduced `ProjectComplexRexNodeCorrelateTransposeRule`. But this rule only matched `LogicalCorrelate -> Uncollect -> LogicalProject` pattern. So all other combinations, which have `LogicalCorrelate`, `Uncollect` and `LogicalProject` with rel nodes between `LogicalCorrelate` and `Uncollect` weren't handled.
   
   The solution proposed in this PR is to make visitor based on `ProjectComplexRexNodeCorrelateTransposeRule` and apply it before applying rules, so all possible cases will be handled correctly.
   
   For details please see [DRILL-6703](https://issues.apache.org/jira/browse/DRILL-6703).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> 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 &amp; Optimization
>    Affects Versions: 1.14.0
>            Reporter: Volodymyr Vysotskyi
>            Assignee: Volodymyr Vysotskyi
>            Priority: Major
>             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)