imay commented on a change in pull request #246: Colocate Join (#245) URL: https://github.com/apache/incubator-doris/pull/246#discussion_r226545407
########## File path: fe/src/com/baidu/palo/planner/DistributedPlanner.java ########## @@ -393,6 +412,83 @@ private PlanFragment createHashJoinFragment(HashJoinNode node, PlanFragment righ } } + private boolean canColocateJoin(HashJoinNode node, PlanFragment leftChildFragment, PlanFragment rightChildFragment) { + if (ctx_.getQueryOptions().disable_colocate_join) { + return false; + } + + PlanNode leftRoot = leftChildFragment.getPlanRoot(); + PlanNode rightRoot = rightChildFragment.getPlanRoot(); + + //leftRoot could be ScanNode or HashJoinNode, rightRoot should be ScanNode + if (leftRoot instanceof OlapScanNode && rightRoot instanceof OlapScanNode) { + return canColocateJoin(node, leftRoot, rightRoot); + } + + if (leftRoot instanceof HashJoinNode && rightRoot instanceof OlapScanNode) { + while (leftRoot instanceof HashJoinNode) { + if (((HashJoinNode)leftRoot).isColocate()) { + leftRoot = leftRoot.getChild(0); + } else { + return false; + } + } + return canColocateJoin(node, leftRoot, rightRoot); + } + + return false; + } + + + Review comment: code style: should be one empty line ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@doris.apache.org For additional commands, e-mail: dev-h...@doris.apache.org