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

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

HanumathRao commented on a change in pull request #1299: DRILL-6456: Planner 
shouldn't create any exchanges on the right side …
URL: https://github.com/apache/drill/pull/1299#discussion_r192181853
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/ExcessiveExchangeIdentifier.java
 ##########
 @@ -70,6 +78,40 @@ public Prel visitScan(ScanPrel prel, MajorFragmentStat s) 
throws RuntimeExceptio
     return prel;
   }
 
+  @Override
+  public Prel visitCorrelate(CorrelatePrel prel, MajorFragmentStat s) throws 
RuntimeException {
+    List<RelNode> children = Lists.newArrayList();
+    s.add(prel);
+
+    for (Prel p : prel) {
+      s.add(p);
+    }
+
+    // Traverse the left side of the Lateral join first. Left side of the
+    // Lateral shouldn't have any restrictions on Exchanges.
+    children.add(((Prel)prel.getInput(0)).accept(this, s));
+    // Save the outermost Lateral join so as to unset the flag later.
+    if (topMostLateralJoin.size() == 0) {
+      topMostLateralJoin.add(prel);
+    }
+
+    // Right side of the Lateral shouldn't have any Exchanges. Hence set the
+    // flag so that visitExchange removes the exchanges.
+    s.setRightSideOfLateral(true);
+    children.add(((Prel)prel.getInput(1)).accept(this, s));
+    if (topMostLateralJoin.contains(prel)) {
+      topMostLateralJoin.remove(prel);
+      s.setRightSideOfLateral(false);
+    }
+    return (Prel) prel.copy(prel.getTraitSet(), children);
+  }
+
+  @Override
+  public Prel visitUnnest(UnnestPrel prel, MajorFragmentStat s) throws 
RuntimeException {
+    s.addUnnest(prel);
 
 Review comment:
   Unnest visitor needs no specialization, but I thought Unnest is more like a 
scan (i.e a leaf node) hence I just thought of introducing it.

----------------------------------------------------------------
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:
[email protected]


> Planner shouldn't create any exchanges on the right side of Lateral Join.
> -------------------------------------------------------------------------
>
>                 Key: DRILL-6456
>                 URL: https://issues.apache.org/jira/browse/DRILL-6456
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Query Planning &amp; Optimization
>    Affects Versions: 1.14.0
>            Reporter: Hanumath Rao Maduri
>            Assignee: Hanumath Rao Maduri
>            Priority: Major
>             Fix For: 1.14.0
>
>
> Currently, there is no restriction placed on right side of the LateralJoin. 
> This is causing planner to generate an Exchange when there are operators like 
> (Agg, Limit, Sort etc). 
> Due to this unnest operator cannot retrieve the row from lateral's left side 
> to process the pipeline further. Enhance the planner to not generate 
> exchanges on the right side of the LateralJoin.



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

Reply via email to