Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,12 @@ private boolean canColocateJoin(HashJoinNode node, PlanFragment leftChildFragmen
return false;
}

// If user have a join hint to use proper way of join, can not be colocate join
if (node.getInnerRef().hasJoinHints()) {
cannotReason.add("Has join hint");
return false;
}

PlanNode leftRoot = leftChildFragment.getPlanRoot();
PlanNode rightRoot = rightChildFragment.getPlanRoot();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,10 @@ public void testColocateJoin() throws Exception {
String explainString = UtFrameUtils.getSQLPlanOrErrorMsg(connectContext, queryStr);
Assert.assertTrue(explainString.contains("colocate: true"));

queryStr = "explain select * from test.colocate1 t1 join [shuffle] test.colocate2 t2 on t1.k1 = t2.k1 and t1.k2 = t2.k2";
explainString = UtFrameUtils.getSQLPlanOrErrorMsg(connectContext, queryStr);
Assert.assertTrue(explainString.contains("colocate: false"));

// t1.k1 = t2.k2 not same order with distribute column
queryStr = "explain select * from test.colocate1 t1, test.colocate2 t2 where t1.k1 = t2.k2 and t1.k2 = t2.k1 and t1.k3 = t2.k3";
explainString = UtFrameUtils.getSQLPlanOrErrorMsg(connectContext, queryStr);
Expand Down