mirror of
https://github.com/actiontech/dble.git
synced 2026-01-05 20:30:40 -06:00
optimize er left join global (#2334)
* optimize er left join global
* optimize er left join global
* fix checkstyle
(cherry picked from commit 2f6b3bfec1)
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
"http://checkstyle.sourceforge.net/dtds/suppressions_1_1.dtd">
|
||||
|
||||
<suppressions>
|
||||
<suppress checks=".*" files="StructureMeta.java"/>
|
||||
<suppress checks=".*" files="UcoreInterface.java"/>
|
||||
<suppress checks=".*" files="UcoreGrpc.java"/>
|
||||
<suppress checks=".*" files="AlertBlockQueue.java"/>
|
||||
@@ -24,6 +23,7 @@
|
||||
<suppress checks=".*" files="BTraceCostTime.java"/>
|
||||
<suppress checks="CyclomaticComplexity" files="CreateTableParserImp.java"/>
|
||||
<suppress checks="CyclomaticComplexity" files="XMLSchemaLoader.java"/>
|
||||
<suppress checks="CyclomaticComplexity" files="GlobalTableProcessor.java"/>
|
||||
<suppress checks="UncommentedMain" files="XmltoCluster.java"/>
|
||||
<suppress checks="UncommentedMain" files="XmltoZkMain.java"/>
|
||||
</suppressions>
|
||||
@@ -77,7 +77,7 @@ public class ERJoinChooser {
|
||||
* left join's ER is different from inner join's
|
||||
* ex:t1,t2 ,if t1 left join t2 on
|
||||
* t1.id=t2.id can be pushed
|
||||
* < we cna't change left join's structure>
|
||||
* < we can't change left join's structure>
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -107,6 +107,7 @@ public class ERJoinChooser {
|
||||
return null;
|
||||
else if (!PlanUtil.isERNode(child) && child.type() != PlanNode.PlanNodeType.TABLE)
|
||||
return null;
|
||||
|
||||
if (onItem == null || !onItem.type().equals(Item.ItemType.FIELD_ITEM))
|
||||
return null;
|
||||
Pair<TableNode, ItemField> joinColumnInfo = PlanUtil.findColumnInTableLeaf((ItemField) onItem, joinNode);
|
||||
@@ -130,7 +131,7 @@ public class ERJoinChooser {
|
||||
/* ------------------- left join optimizer end -------------------- */
|
||||
|
||||
/**
|
||||
* inner join's ER, rebuild inner joi's unit
|
||||
* inner join's ER, rebuild inner join's unit
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -390,7 +391,8 @@ public class ERJoinChooser {
|
||||
private boolean isUnit(PlanNode node) {
|
||||
if (isGlobalTree(node))
|
||||
return true;
|
||||
else return node.type() != PlanNode.PlanNodeType.JOIN || node.isWithSubQuery() || !((JoinNode) node).isInnerJoin();
|
||||
else
|
||||
return node.type() != PlanNode.PlanNodeType.JOIN || node.isWithSubQuery() || !((JoinNode) node).isInnerJoin();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -55,8 +55,7 @@ public final class GlobalTableProcessor {
|
||||
if (PlanUtil.isERNode(tn)) {
|
||||
// treat er join as an un global table
|
||||
tn.setUnGlobalTableCount(1);
|
||||
Set<String> newSet = new HashSet<>();
|
||||
newSet.addAll(tn.getReferedTableNodes().get(0).getNoshardNode());
|
||||
Set<String> newSet = new HashSet<>(tn.getReferedTableNodes().get(0).getNoshardNode());
|
||||
tn.setNoshardNode(newSet);
|
||||
} else {
|
||||
int unGlobalCount = calcUnGlobalCount(tn);
|
||||
@@ -84,7 +83,9 @@ public final class GlobalTableProcessor {
|
||||
if (left.getUnGlobalTableCount() == 0) { // left node is global,left join will not push down
|
||||
tn.setNoshardNode(null);
|
||||
status = false;
|
||||
} else if (left.type() == PlanNode.PlanNodeType.TABLE || PlanUtil.isERNode(left)) {
|
||||
} else if (left.type() == PlanNode.PlanNodeType.TABLE ||
|
||||
PlanUtil.isERNode(left) ||
|
||||
left.getNoshardNode() != null && left.getNoshardNode().size() > 0) {
|
||||
if (!isGlobalTableBigEnough(jn)) {
|
||||
tn.setNoshardNode(null);
|
||||
status = false;
|
||||
|
||||
Reference in New Issue
Block a user