Search in sources :

Example 1 with ItemString

use of com.actiontech.dble.plan.common.item.ItemString in project dble by actiontech.

the class JoinNodeHandlerBuilder method buildNestFiltersForExplain.

private void buildNestFiltersForExplain(PlanNode tnBig, Item keyToPass) {
    Item keyInBig = PlanUtil.pushDownItem(node, keyToPass);
    List<Item> strategyFilters = tnBig.getNestLoopFilters();
    List<Item> argList = new ArrayList<>();
    argList.add(keyInBig);
    argList.add(new ItemString(NEED_REPLACE));
    ItemFuncIn filter = new ItemFuncIn(argList, false);
    strategyFilters.add(filter);
}
Also used : Item(com.actiontech.dble.plan.common.item.Item) ItemFuncIn(com.actiontech.dble.plan.common.item.function.operator.cmpfunc.ItemFuncIn) ArrayList(java.util.ArrayList) ItemString(com.actiontech.dble.plan.common.item.ItemString)

Example 2 with ItemString

use of com.actiontech.dble.plan.common.item.ItemString in project dble by actiontech.

the class JoinNodeHandlerBuilder method buildNestFilters.

/**
 * generate filter for big table according to tmp(small) table's result
 *
 * @param tnBig
 * @param keyToPass
 * @param valueSet
 */
protected void buildNestFilters(PlanNode tnBig, Item keyToPass, Set<String> valueSet, int maxPartSize) {
    List<Item> strategyFilters = tnBig.getNestLoopFilters();
    List<Item> partList = null;
    Item keyInBig = PlanUtil.pushDownItem(node, keyToPass);
    int partSize = 0;
    for (String value : valueSet) {
        if (partList == null)
            partList = new ArrayList<>();
        if (value == null) {
            // is null will never join
            continue;
        } else {
            partList.add(new ItemString(value));
            if (++partSize >= maxPartSize) {
                List<Item> argList = new ArrayList<>();
                argList.add(keyInBig);
                argList.addAll(partList);
                ItemFuncIn inFilter = new ItemFuncIn(argList, false);
                strategyFilters.add(inFilter);
                partList = null;
                partSize = 0;
            }
        }
    }
    if (partSize > 0) {
        List<Item> argList = new ArrayList<>();
        argList.add(keyInBig);
        argList.addAll(partList);
        ItemFuncIn inFilter = new ItemFuncIn(argList, false);
        strategyFilters.add(inFilter);
    }
    // if no data
    if (strategyFilters.isEmpty()) {
        strategyFilters.add(new ItemInt(0));
    }
}
Also used : Item(com.actiontech.dble.plan.common.item.Item) ItemFuncIn(com.actiontech.dble.plan.common.item.function.operator.cmpfunc.ItemFuncIn) ItemInt(com.actiontech.dble.plan.common.item.ItemInt) ArrayList(java.util.ArrayList) ItemString(com.actiontech.dble.plan.common.item.ItemString) ItemString(com.actiontech.dble.plan.common.item.ItemString)

Aggregations

Item (com.actiontech.dble.plan.common.item.Item)2 ItemString (com.actiontech.dble.plan.common.item.ItemString)2 ItemFuncIn (com.actiontech.dble.plan.common.item.function.operator.cmpfunc.ItemFuncIn)2 ArrayList (java.util.ArrayList)2 ItemInt (com.actiontech.dble.plan.common.item.ItemInt)1