use of com.actiontech.dble.plan.node.PlanNode in project dble by actiontech.
the class FilterPusher method mergeJoinOnFilter.
/**
* merge inner joi's otheron to where if we can
*
* @param qtn
* @return
*/
private static void mergeJoinOnFilter(PlanNode qtn) {
if (PlanUtil.isGlobalOrER(qtn))
return;
if (qtn.type().equals(PlanNodeType.JOIN) && ((JoinNode) qtn).isInnerJoin()) {
JoinNode jn = (JoinNode) qtn;
Item otherJoinOn = jn.getOtherJoinOnFilter();
jn.setOtherJoinOnFilter(null);
jn.query(FilterUtils.and(otherJoinOn, jn.getWhereFilter()));
}
for (PlanNode child : qtn.getChildren()) {
mergeJoinOnFilter(child);
}
}
use of com.actiontech.dble.plan.node.PlanNode in project dble by actiontech.
the class FilterPusher method getMergeNode.
private static PlanNode getMergeNode(PlanNode qtn, List<Item> dnfNodeToPush) {
// union's where can be pushed down ,but it must be replace to child's condition
Item node = FilterUtils.and(dnfNodeToPush);
if (node != null) {
qtn.query(FilterUtils.and(qtn.getWhereFilter(), node));
}
Item mergeWhere = qtn.getWhereFilter();
// push down merge's condition
qtn.query(null);
List<Item> pushFilters = PlanUtil.getPushItemsToUnionChild((MergeNode) qtn, mergeWhere, ((MergeNode) qtn).getColIndexs());
List<PlanNode> childs = qtn.getChildren();
for (int index = 0; index < childs.size(); index++) {
PlanNode child = childs.get(index);
if (pushFilters != null) {
Item pushFilter = pushFilters.get(index);
child.query(FilterUtils.and(child.getWhereFilter(), pushFilter));
}
FilterPusher.optimize(child);
}
return qtn;
}
use of com.actiontech.dble.plan.node.PlanNode in project dble by actiontech.
the class GlobalTableProcessor method calcUnGlobalCount.
private static int calcUnGlobalCount(PlanNode tn) {
int unGlobalCount = 0;
for (ItemSubQuery subQuery : tn.getSubQueries()) {
PlanNode subNode = subQuery.getPlanNode();
resetNoShardNode(tn, subNode);
unGlobalCount += subNode.getUnGlobalTableCount();
}
for (PlanNode tnChild : tn.getChildren()) {
if (tnChild != null) {
resetNoShardNode(tn, tnChild);
unGlobalCount += tnChild.getUnGlobalTableCount();
}
}
return unGlobalCount;
}
use of com.actiontech.dble.plan.node.PlanNode in project dble by actiontech.
the class JoinERProcessor method optimize.
public static PlanNode optimize(PlanNode qtn) {
if (qtn instanceof JoinNode) {
qtn = new ERJoinChooser((JoinNode) qtn).optimize();
} else {
for (int i = 0; i < qtn.getChildren().size(); i++) {
PlanNode sub = qtn.getChildren().get(i);
qtn.getChildren().set(i, optimize(sub));
}
}
return qtn;
}
use of com.actiontech.dble.plan.node.PlanNode in project dble by actiontech.
the class JoinStrategyProcessor method optimize.
public static PlanNode optimize(PlanNode qtn) {
if (PlanUtil.isGlobalOrER(qtn))
return qtn;
if (qtn.type() == PlanNode.PlanNodeType.JOIN) {
JoinNode jn = (JoinNode) qtn;
if (jn.getLeftNode().type() == PlanNode.PlanNodeType.TABLE && jn.getRightNode().type() == PlanNode.PlanNodeType.TABLE) {
JoinStrategyChooser chooser = new JoinStrategyChooser((JoinNode) qtn);
chooser.tryNestLoop();
return qtn;
}
}
for (PlanNode child : qtn.getChildren()) optimize(child);
return qtn;
}
Aggregations