当前位置: 首页>>代码示例>>Java>>正文


Java IBooleanFilter.setValue方法代码示例

本文整理汇总了Java中com.taobao.tddl.optimizer.core.expression.IBooleanFilter.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java IBooleanFilter.setValue方法的具体用法?Java IBooleanFilter.setValue怎么用?Java IBooleanFilter.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.taobao.tddl.optimizer.core.expression.IBooleanFilter的用法示例。


在下文中一共展示了IBooleanFilter.setValue方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildBooleanFilter

import com.taobao.tddl.optimizer.core.expression.IBooleanFilter; //导入方法依赖的package包/类
protected void buildBooleanFilter(IBooleanFilter filter) {
    if (filter == null) {
        return;
    }

    Object column = filter.getColumn();
    Object value = filter.getValue();

    if (column instanceof ISelectable) {
        filter.setColumn(this.buildSelectable((ISelectable) column));
    }

    if (value instanceof ISelectable) {
        filter.setValue(this.buildSelectable((ISelectable) value));
    }

    if (value != null && value instanceof IFunction && ((IFunction) value).getArgs().size() > 0) {
        Object arg = ((IFunction) value).getArgs().get(0);
        if (arg instanceof QueryTreeNode) {
        }
    }

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:24,代码来源:BaseShowNode.java

示例2: copyFilterToJoinOnColumns

import com.taobao.tddl.optimizer.core.expression.IBooleanFilter; //导入方法依赖的package包/类
/**
 * 将连接列上的约束复制到目标节点内
 * 
 * @param DNF 要复制的DNF filter
 * @param other 要复制的目标节点
 * @param qnColumns 源节点的join字段
 * @param otherColumns 目标节点的join字段
 * @throws QueryException
 */
private static List<IFilter> copyFilterToJoinOnColumns(List<IFilter> DNF, List<ISelectable> qnColumns,
                                                       List<ISelectable> otherColumns) throws QueryException {
    List<IFilter> newIFilterToPush = new LinkedList<IFilter>();
    for (IFilter bool : DNF) {
        int index = qnColumns.indexOf(((IBooleanFilter) bool).getColumn());
        if (index >= 0) {// 只考虑在源查找,在目标查找在上一层进行控制
            IBooleanFilter o = ASTNodeFactory.getInstance().createBooleanFilter().setOperation(bool.getOperation());
            o.setColumn(otherColumns.get(index));
            if (bool.getOperation() == OPERATION.IN) {
                o.setValues(((IBooleanFilter) bool).getValues());
            } else {
                o.setValue(((IBooleanFilter) bool).getValue());
            }
            newIFilterToPush.add(o);
        }
    }

    return newIFilterToPush;
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:29,代码来源:FilterPusher.java

示例3: equal

import com.taobao.tddl.optimizer.core.expression.IBooleanFilter; //导入方法依赖的package包/类
/**
 * 创建equal filter
 */
public static IBooleanFilter equal(Object columnName, Object value) {
    IBooleanFilter f = ASTNodeFactory.getInstance().createBooleanFilter();
    f.setOperation(OPERATION.EQ);
    f.setColumn(columnName);
    f.setValue(value);
    return f;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:11,代码来源:FilterUtils.java

示例4: buildBooleanFilter

import com.taobao.tddl.optimizer.core.expression.IBooleanFilter; //导入方法依赖的package包/类
public IBooleanFilter buildBooleanFilter(Object column, Object value, OPERATION operation, Expression exp) {
    IBooleanFilter ibf = ASTNodeFactory.getInstance().createBooleanFilter();
    ibf.setColumn(column);
    ibf.setValue(value);
    ibf.setOperation(operation);
    if (exp != null) {
        ibf.setColumnName(getSqlExprStr(exp)); // 比如将count(*)做为columnName
    }
    return ibf;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:11,代码来源:MySqlExprVisitor.java

示例5: exchage

import com.taobao.tddl.optimizer.core.expression.IBooleanFilter; //导入方法依赖的package包/类
/**
 * 如果是1 = id的情况,转化为id = 1
 */
private static IFilter exchage(IFilter root) {
    IBooleanFilter bf = (IBooleanFilter) root;
    if (!FilterUtils.isConstValue(bf.getValue()) && FilterUtils.isConstValue(bf.getColumn())) {
        Object val = bf.getColumn();
        bf.setColumn(bf.getValue());
        bf.setValue(val);
        OPERATION newOp = bf.getOperation();
        switch (bf.getOperation()) {
            case GT:
                newOp = OPERATION.LT;
                break;
            case LT:
                newOp = OPERATION.GT;
                break;
            case GT_EQ:
                newOp = OPERATION.LT_EQ;
                break;
            case LT_EQ:
                newOp = OPERATION.GT_EQ;
                break;
            default:
                break;
        }
        bf.setOperation(newOp);
    }
    return bf;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:31,代码来源:FilterPreProcessor.java

示例6: equal

import com.taobao.tddl.optimizer.core.expression.IBooleanFilter; //导入方法依赖的package包/类
/**
 * 创建equal filter
 */
public static IBooleanFilter equal(Comparable columnName, Comparable value) {
    IBooleanFilter f = ASTNodeFactory.getInstance().createBooleanFilter();
    f.setOperation(OPERATION.EQ);
    f.setColumn(columnName);
    f.setValue(value);
    return f;
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:11,代码来源:FilterUtils.java

示例7: buildBooleanFilter

import com.taobao.tddl.optimizer.core.expression.IBooleanFilter; //导入方法依赖的package包/类
protected void buildBooleanFilter(IBooleanFilter filter, boolean findInSelectList) {
    if (filter == null) {
        return;
    }

    if (filter.getColumn() instanceof ISelectable) {
        filter.setColumn(this.buildSelectable((ISelectable) filter.getColumn(), findInSelectList));
    }

    if (filter.getColumn() instanceof QueryTreeNode) {
        // subQuery,比如WHERE ID = (SELECT ID FROM A)
        ((QueryTreeNode) filter.getColumn()).build();
    }

    if (filter.getValue() instanceof ISelectable) {
        filter.setValue(this.buildSelectable((ISelectable) filter.getValue(), findInSelectList));
    }

    if (filter.getValue() instanceof QueryTreeNode) {
        // subQuery,比如WHERE ID = (SELECT ID FROM A)
        ((QueryTreeNode) filter.getValue()).build();
    }

    if (filter.getOperation() == OPERATION.IN) {
        List<Object> values = filter.getValues();
        if (values != null && !values.isEmpty() && values.get(0) instanceof QueryTreeNode) {
            // in的子查询
            ((QueryTreeNode) values.get(0)).build();
        }
    }
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:32,代码来源:QueryTreeNodeBuilder.java

示例8: buildFilter

import com.taobao.tddl.optimizer.core.expression.IBooleanFilter; //导入方法依赖的package包/类
/**
 * 根据range结果,构造filter
 * 
 * @param range
 * @param column
 * @return
 */
protected List<IFilter> buildFilter(Range range, Object column) {
    List<IFilter> filters = new ArrayList(2);
    if (range == null) {
        return filters;
    }

    if (range.isSingleValue()) {
        IBooleanFilter en = ASTNodeFactory.getInstance().createBooleanFilter().setOperation(OPERATION.EQ);
        en.setColumn(column);
        en.setValue(range.getMaxValue());
        filters.add(en);
        return filters;
    }

    if (range.getMinValue() != null) {
        IBooleanFilter gn;
        if (range.isMinIncluded()) {
            gn = ASTNodeFactory.getInstance().createBooleanFilter().setOperation(OPERATION.GT_EQ);
        } else {
            gn = ASTNodeFactory.getInstance().createBooleanFilter().setOperation(OPERATION.GT);
        }

        gn.setColumn(column);
        gn.setValue(range.getMinValue());
        filters.add(gn);
    }

    if (range.getMaxValue() != null) {
        IBooleanFilter ln;
        if (range.isMaxIncluded()) {
            ln = ASTNodeFactory.getInstance().createBooleanFilter().setOperation(OPERATION.LT_EQ);
        } else {
            ln = ASTNodeFactory.getInstance().createBooleanFilter().setOperation(OPERATION.LT);
        }

        ln.setColumn(column);
        ln.setValue(range.getMaxValue());
        filters.add(ln);
    }
    return filters;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:49,代码来源:AbstractRangeProcessor.java

示例9: convertJoinOnColumns

import com.taobao.tddl.optimizer.core.expression.IBooleanFilter; //导入方法依赖的package包/类
private IBooleanFilter convertJoinOnColumns(IBooleanFilter filter) {
    IBooleanFilter newbf = filter.copy();
    newbf.setColumn(filter.getValue());
    newbf.setValue((Comparable) filter.getColumn());
    return newbf;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:7,代码来源:JoinPermutationGenerator.java

示例10: buildJoinKeys

import com.taobao.tddl.optimizer.core.expression.IBooleanFilter; //导入方法依赖的package包/类
private void buildJoinKeys() {
    if (this.getNode().isUedForIndexJoinPK()) {
        return;
    }
    List<IBooleanFilter> otherJoinOnFilters = new ArrayList(this.getNode().getJoinFilter().size());
    for (IBooleanFilter f : this.getNode().getJoinFilter()) {
        ISelectable leftKey = null;
        if (f.getColumn() != null && f.getColumn() instanceof ISelectable) {
            leftKey = this.getColumnFromOtherNode((ISelectable) f.getColumn(), this.getNode().getLeftNode());
        }

        ISelectable rightKey = null;
        if (f.getValue() != null && f.getValue() instanceof ISelectable) {
            rightKey = this.getColumnFromOtherNode((ISelectable) f.getValue(), this.getNode().getRightNode());
        }

        // 可能顺序调换了,重新找一次
        if (leftKey == null || rightKey == null) {
            if (f.getValue() != null && f.getValue() instanceof ISelectable) {
                leftKey = this.getColumnFromOtherNode((ISelectable) f.getValue(), this.getNode().getLeftNode());
            }

            if (f.getColumn() != null && f.getColumn() instanceof ISelectable) {
                rightKey = this.getColumnFromOtherNode((ISelectable) f.getColumn(), this.getNode().getRightNode());
            }
        }

        if (leftKey == null || rightKey == null) {
            // 可能有以下情况
            // id=1,s.id=s.key_id
            IFilter otherJoinOnFilter = this.getNode().getOtherJoinOnFilter();
            otherJoinOnFilter = FilterUtils.and(otherJoinOnFilter, f);
            this.getNode().setOtherJoinOnFilter(otherJoinOnFilter);
            otherJoinOnFilters.add(f);
            continue;
        }

        /**
         * 如果是回表操作,不能把索引的joinKey添加到temp中,否则如果有merge,这个列会被加到sql的select中,
         * 而导致找不到列
         */
        if (!this.getNode().isUedForIndexJoinPK()) {
            f.setColumn(buildSelectable(leftKey));
            f.setValue(buildSelectable(rightKey));
        }

    }

    this.getNode().getJoinFilter().removeAll(otherJoinOnFilters);
    this.buildFilter(this.getNode().getOtherJoinOnFilter(), false);
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:52,代码来源:JoinNodeBuilder.java


注:本文中的com.taobao.tddl.optimizer.core.expression.IBooleanFilter.setValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。