本文整理匯總了Java中com.taobao.tddl.optimizer.core.ast.query.JoinNode.getRightNode方法的典型用法代碼示例。如果您正苦於以下問題:Java JoinNode.getRightNode方法的具體用法?Java JoinNode.getRightNode怎麽用?Java JoinNode.getRightNode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.taobao.tddl.optimizer.core.ast.query.JoinNode
的用法示例。
在下文中一共展示了JoinNode.getRightNode方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isJoinOnPartition
import com.taobao.tddl.optimizer.core.ast.query.JoinNode; //導入方法依賴的package包/類
/**
* 找到join條件完全是分區鍵的filter,返回null代表沒找到,否則返回join條件
*/
private static PartitionJoinResult isJoinOnPartition(JoinNode join) {
QueryTreeNode left = join.getLeftNode();
QueryTreeNode right = join.getRightNode();
PartitionJoinResult leftResult = isJoinOnPartitionOneSide(join.getLeftKeys(), left);
PartitionJoinResult rightResult = isJoinOnPartitionOneSide(join.getRightKeys(), right);
// 允許一張單表和一張廣播表的組合
if (!leftResult.flag && !rightResult.broadcast) {
return leftResult;
}
if (!rightResult.flag && !leftResult.broadcast) {
return rightResult;
}
PartitionJoinResult result = new PartitionJoinResult();
result.broadcast = leftResult.broadcast || rightResult.broadcast;
result.flag = StringUtils.equalsIgnoreCase(leftResult.joinGroup, rightResult.joinGroup) || result.broadcast;
result.joinGroup = leftResult.joinGroup;
result.joinFilters = join.getJoinFilter();
return result;
}
示例2: isJoinOnPartition
import com.taobao.tddl.optimizer.core.ast.query.JoinNode; //導入方法依賴的package包/類
/**
* 找到join條件完全是分區鍵的filter,返回null代表沒找到,否則返回join條件
*/
private static PartitionJoinResult isJoinOnPartition(JoinNode join) {
QueryTreeNode left = join.getLeftNode();
QueryTreeNode right = join.getRightNode();
PartitionJoinResult leftResult = isJoinOnPartitionOneSide(join.getLeftKeys(), left);
if (!leftResult.flag) {
return leftResult;
}
PartitionJoinResult rightResult = isJoinOnPartitionOneSide(join.getRightKeys(), right);
if (!rightResult.flag) {
return rightResult;
}
PartitionJoinResult result = new PartitionJoinResult();
result.broadcast = leftResult.broadcast || rightResult.broadcast;
result.flag = StringUtils.equalsIgnoreCase(leftResult.joinGroup, rightResult.joinGroup) || result.broadcast;
result.joinGroup = leftResult.joinGroup;
result.joinFilters = join.getJoinFilter();
return result;
}
示例3: findJoinKeysAndRemoveIt
import com.taobao.tddl.optimizer.core.ast.query.JoinNode; //導入方法依賴的package包/類
/**
* 將原本的Join的where條件中的a.id=b.id構建為join條件,並從where條件中移除
*/
private static void findJoinKeysAndRemoveIt(List<IFilter> DNFNode, JoinNode join) {
// filter中可能包含join列,如id=id
// 目前必須滿足以下條件
// 1、不包含or
// 2、=連接
List<IFilter> joinFilters = new LinkedList();
if (isFilterContainsColumnJoin(DNFNode)) {
List<Object> leftJoinKeys = new ArrayList<Object>();
List<Object> rightJoinKeys = new ArrayList<Object>();
for (IFilter sub : DNFNode) { // 一定是簡單條件
if (!(sub instanceof IBooleanFilter)) {
continue;
}
ISelectable[] keys = getJoinKeysWithColumnJoin((IBooleanFilter) sub);
if (keys != null) {// 存在join column
if (join.getLeftNode().hasColumn(keys[0])) {
if (!join.getLeftNode().hasColumn(keys[1])) {
if (join.getRightNode().hasColumn(keys[1])) {
leftJoinKeys.add(keys[0]);
rightJoinKeys.add(keys[1]);
joinFilters.add(sub);
join.addJoinFilter((IBooleanFilter) sub);
} else {
throw new IllegalArgumentException("join查詢表右邊不包含join column,請修改查詢語句...");
}
} else {
if (!(join.getLeftNode() instanceof JoinNode)) {
throw new IllegalArgumentException("join查詢的join column都在左表上,請修改查詢語句...");
}
}
} else if (join.getLeftNode().hasColumn(keys[1])) {
if (!join.getLeftNode().hasColumn(keys[0])) {
if (join.getRightNode().hasColumn(keys[0])) {
leftJoinKeys.add(keys[1]);
rightJoinKeys.add(keys[0]);
joinFilters.add(sub);
// 交換一下
Object tmp = ((IBooleanFilter) sub).getColumn();
((IBooleanFilter) sub).setColumn(((IBooleanFilter) sub).getValue());
((IBooleanFilter) sub).setValue(tmp);
join.addJoinFilter((IBooleanFilter) sub);
} else {
throw new IllegalArgumentException("join查詢表左邊不包含join column,請修改查詢語句...");
}
} else {
if (!(join.getRightNode() instanceof JoinNode)) {
throw new IllegalArgumentException("join查詢的join column都在右表上,請修改查詢語句...");
}
}
}
}
}
DNFNode.removeAll(joinFilters);
}
join.build();
}
示例4: findJoinKeysAndRemoveIt
import com.taobao.tddl.optimizer.core.ast.query.JoinNode; //導入方法依賴的package包/類
/**
* 將原本的Join的where條件中的a.id=b.id構建為join條件,並從where條件中移除
*/
private static void findJoinKeysAndRemoveIt(List<IFilter> DNFNode, JoinNode join) throws QueryException {
// filter中可能包含join列,如id=id
// 目前必須滿足以下條件
// 1、不包含or
// 2、=連接
List<IFilter> joinFilters = new LinkedList();
if (isFilterContainsColumnJoin(DNFNode)) {
List<Object> leftJoinKeys = new ArrayList<Object>();
List<Object> rightJoinKeys = new ArrayList<Object>();
for (IFilter sub : DNFNode) { // 一定是簡單條件
ISelectable[] keys = getJoinKeysWithColumnJoin((IBooleanFilter) sub);
if (keys != null) {// 存在join column
if (join.getLeftNode().hasColumn(keys[0])) {
if (!join.getLeftNode().hasColumn(keys[1])) {
if (join.getRightNode().hasColumn(keys[1])) {
leftJoinKeys.add(keys[0]);
rightJoinKeys.add(keys[1]);
joinFilters.add(sub);
join.addJoinFilter((IBooleanFilter) sub);
} else {
throw new IllegalArgumentException("join查詢表右邊不包含join column,請修改查詢語句...");
}
} else {
if (!(join.getLeftNode() instanceof JoinNode)) {
throw new IllegalArgumentException("join查詢的join column都在左表上,請修改查詢語句...");
}
}
} else if (join.getLeftNode().hasColumn(keys[1])) {
if (!join.getLeftNode().hasColumn(keys[0])) {
if (join.getRightNode().hasColumn(keys[0])) {
leftJoinKeys.add(keys[1]);
rightJoinKeys.add(keys[0]);
joinFilters.add(sub);
// 交換一下
Object tmp = ((IBooleanFilter) sub).getColumn();
((IBooleanFilter) sub).setColumn(((IBooleanFilter) sub).getValue());
((IBooleanFilter) sub).setValue(tmp);
join.addJoinFilter((IBooleanFilter) sub);
} else {
throw new IllegalArgumentException("join查詢表左邊不包含join column,請修改查詢語句...");
}
} else {
if (!(join.getRightNode() instanceof JoinNode)) {
throw new IllegalArgumentException("join查詢的join column都在右表上,請修改查詢語句...");
}
}
}
}
}
DNFNode.removeAll(joinFilters);
}
join.build();
}