[Bug] Support disable colocate join where join clause has join hint (#4497)

Fix issue:#4496
This commit is contained in:
HappenLee
2020-09-02 10:54:45 +08:00
committed by GitHub
parent f5ee854b6f
commit e6367e9ba8
2 changed files with 10 additions and 0 deletions

View File

@ -466,6 +466,12 @@ public class DistributedPlanner {
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();

View File

@ -941,6 +941,10 @@ public class QueryPlanTest {
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);