當前位置: 首頁>>代碼示例>>Java>>正文


Java JoinNode.getRightNode方法代碼示例

本文整理匯總了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;
}
 
開發者ID:loye168,項目名稱:tddl5,代碼行數:26,代碼來源:DataNodeChooser.java

示例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;
}
 
開發者ID:beebeandwer,項目名稱:TDDL,代碼行數:25,代碼來源:DataNodeChooser.java

示例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();
}
 
開發者ID:loye168,項目名稱:tddl5,代碼行數:64,代碼來源:FilterPusher.java

示例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();
}
 
開發者ID:beebeandwer,項目名稱:TDDL,代碼行數:60,代碼來源:FilterPusher.java


注:本文中的com.taobao.tddl.optimizer.core.ast.query.JoinNode.getRightNode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。