diff --git a/dble_checkstyle_suppression.xml b/dble_checkstyle_suppression.xml
index 5548f2444..eb0e7b5c1 100644
--- a/dble_checkstyle_suppression.xml
+++ b/dble_checkstyle_suppression.xml
@@ -23,5 +23,5 @@
-
+
\ No newline at end of file
diff --git a/src/main/java/com/actiontech/dble/plan/optimizer/ERJoinChooser.java b/src/main/java/com/actiontech/dble/plan/optimizer/ERJoinChooser.java
index d04f6a4a5..adc00c3f5 100644
--- a/src/main/java/com/actiontech/dble/plan/optimizer/ERJoinChooser.java
+++ b/src/main/java/com/actiontech/dble/plan/optimizer/ERJoinChooser.java
@@ -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 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();
}
/**
diff --git a/src/main/java/com/actiontech/dble/plan/optimizer/GlobalTableProcessor.java b/src/main/java/com/actiontech/dble/plan/optimizer/GlobalTableProcessor.java
index bfef20a2d..223eaed04 100644
--- a/src/main/java/com/actiontech/dble/plan/optimizer/GlobalTableProcessor.java
+++ b/src/main/java/com/actiontech/dble/plan/optimizer/GlobalTableProcessor.java
@@ -47,8 +47,7 @@ public final class GlobalTableProcessor {
if (PlanUtil.isERNode(tn)) {
// treat er join as an un global table
tn.setUnGlobalTableCount(1);
- Set newSet = new HashSet<>();
- newSet.addAll(tn.getReferedTableNodes().get(0).getNoshardNode());
+ Set newSet = new HashSet<>(tn.getReferedTableNodes().get(0).getNoshardNode());
tn.setNoshardNode(newSet);
} else {
int unGlobalCount = calcUnGlobalCount(tn);
@@ -76,7 +75,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;