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


Java ComparisonExpression类代码示例

本文整理汇总了Java中org.voltdb.expressions.ComparisonExpression的典型用法代码示例。如果您正苦于以下问题:Java ComparisonExpression类的具体用法?Java ComparisonExpression怎么用?Java ComparisonExpression使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: replaceInListFilterWithEqualityFilter

import org.voltdb.expressions.ComparisonExpression; //导入依赖的package包/类
private static void replaceInListFilterWithEqualityFilter(List<AbstractExpression> endExprs,
                                                   AbstractExpression inListRhs,
                                                   AbstractExpression equalityRhs)
{
    for (AbstractExpression comparator : endExprs) {
        AbstractExpression otherExpr = comparator.getRight();
        if (otherExpr == inListRhs) {
            endExprs.remove(comparator);
            AbstractExpression replacement =
                new ComparisonExpression(ExpressionType.COMPARE_EQUAL,
                                         comparator.getLeft(),
                                         equalityRhs);
            endExprs.add(replacement);
            break;
        }
    }
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:18,代码来源:SubPlanAssembler.java

示例2: testParameters

import org.voltdb.expressions.ComparisonExpression; //导入依赖的package包/类
public void testParameters() {
    AbstractPlanNode pn = compile("select A1 FROM (SELECT A A1 FROM R1 WHERE A > ?) TEMP WHERE A1 < ?");
    pn = pn.getChild(0);
    assertTrue(pn instanceof SeqScanPlanNode);
    AbstractExpression p = ((SeqScanPlanNode) pn).getPredicate();
    assertTrue(p != null);
    assertTrue(p instanceof ComparisonExpression);
    AbstractExpression cp = p.getLeft();
    assertTrue(cp instanceof TupleValueExpression);
    cp = p.getRight();
    assertTrue(cp instanceof ParameterValueExpression);
    assertEquals(1, ((ParameterValueExpression)cp).getParameterIndex().intValue());
    assertTrue(pn.getChildCount() == 1);
    assertTrue(pn.getChild(0) instanceof SeqScanPlanNode);
    SeqScanPlanNode sc = (SeqScanPlanNode) pn.getChild(0);
    assertTrue(sc.getPredicate() != null);
    p = sc.getPredicate();
    assertTrue(p instanceof ComparisonExpression);
    cp = p.getRight();
    assertTrue(cp instanceof ParameterValueExpression);
    assertEquals(0, ((ParameterValueExpression)cp).getParameterIndex().intValue());
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:23,代码来源:TestSubQueries.java

示例3: createTempExpression

import org.voltdb.expressions.ComparisonExpression; //导入依赖的package包/类
/**
 * Create a temporary column expression that can be used with
 * extractExpressionColumnSet
 * 
 * @param catalog_col
 * @param exp
 * @return
 */
private static AbstractExpression createTempExpression(Column catalog_col, AbstractExpression exp) {
    Table catalog_tbl = (Table) catalog_col.getParent();

    TupleValueExpression tuple_exp = new TupleValueExpression();
    tuple_exp.setTableName(catalog_tbl.getName());
    tuple_exp.setColumnIndex(catalog_col.getIndex());
    tuple_exp.setColumnAlias(catalog_col.getName());
    tuple_exp.setColumnName(catalog_col.getName());

    return (new ComparisonExpression(ExpressionType.COMPARE_EQUAL, tuple_exp, exp));
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:20,代码来源:CatalogUtil.java

示例4: IndexableExpression

import org.voltdb.expressions.ComparisonExpression; //导入依赖的package包/类
public IndexableExpression(AbstractExpression originalExpr, ComparisonExpression normalizedExpr,
                           List<AbstractExpression> bindings)
{
    m_originalFilter = originalExpr;
    m_filter = normalizedExpr;
    m_bindings = bindings;
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:8,代码来源:SubPlanAssembler.java

示例5: checkPredicateComparisonExpression

import org.voltdb.expressions.ComparisonExpression; //导入依赖的package包/类
private void checkPredicateComparisonExpression(AbstractPlanNode pn, String tableAlias) {
    AbstractExpression expr = ((SeqScanPlanNode) pn).getPredicate();
    assertTrue(expr instanceof ComparisonExpression);
    expr = expr.getLeft();
    assertTrue(expr instanceof TupleValueExpression);
    assertEquals(tableAlias, ((TupleValueExpression) expr).getTableAlias());
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:8,代码来源:TestSubQueries.java

示例6: debug

import org.voltdb.expressions.ComparisonExpression; //导入依赖的package包/类
public static String debug(AbstractExpression exp, String spacer) {
    assert (exp != null);
    final String orig_spacer = spacer;
    String name = exp.getClass().getSimpleName();
    ExpressionType etype = exp.getExpressionType();

    final StringBuilder sb = new StringBuilder();
    spacer += "   ";
    sb.append(spacer).append("ValueType[").append(exp.getValueType()).append("]\n");

    if (exp instanceof AggregateExpression) {
        // Nothing
    } else if (exp instanceof ComparisonExpression) {
        name += "[" + etype.name().replace("COMPARE_", "") + "]";
    } else if (exp instanceof ConjunctionExpression) {
        name += "[" + etype.name().replace("CONJUNCTION_", "") + "]";
    } else if (exp instanceof ConstantValueExpression) {
        sb.append(spacer).append("Value[").append(((ConstantValueExpression) exp).getValue()).append("]\n");
    } else if (exp instanceof InComparisonExpression) {
        InComparisonExpression in_exp = (InComparisonExpression) exp;
        sb.append(spacer).append("Values[").append(in_exp.getValues().size()).append("]:\n");
        for (int ctr = 0, cnt = in_exp.getValues().size(); ctr < cnt; ctr++) {
            sb.append(ExpressionUtil.debug(in_exp.getValues().get(ctr), spacer));
        } // FOR
    } else if (exp instanceof NullValueExpression) {
        // Nothing
    } else if (exp instanceof OperatorExpression) {
        name += "[" + etype.name().replace("OPERATOR_", "") + "]";
    } else if (exp instanceof ParameterValueExpression) {
        sb.append(spacer).append("Parameter[").append(((ParameterValueExpression) exp).getParameterId()).append("]\n");
    } else if (exp instanceof TupleAddressExpression) {
        // Nothing
    } else if (exp instanceof TupleValueExpression) {
        sb.append(spacer).append("Column Reference: ").append("[").append(((TupleValueExpression) exp).getColumnIndex()).append("] ").append(((TupleValueExpression) exp).getTableName())
                .append(".").append(((TupleValueExpression) exp).getColumnName()).append(" AS ").append(((TupleValueExpression) exp).getColumnAlias()).append("\n");
    }

    // Print out all of our children
    if (exp.getLeft() != null || exp.getRight() != null) {
        sb.append(spacer).append("left:  ").append(exp.getLeft() != null ? "\n" + ExpressionUtil.debug(exp.getLeft(), spacer) : null + "\n");
        sb.append(spacer).append("right:  ").append(exp.getRight() != null ? "\n" + ExpressionUtil.debug(exp.getRight(), spacer) : null + "\n");
    }

    return (orig_spacer + "+ " + name + "\n" + sb.toString());
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:46,代码来源:ExpressionUtil.java

示例7: testCombine

import org.voltdb.expressions.ComparisonExpression; //导入依赖的package包/类
/**
 *
 *
 */
public void testCombine() {
    //
    // We create a bunch of individual ComparisonExpression trees and we then
    // combine them into a single tree created with AND conjunctions
    //
    int num_of_subtrees = 5;
    final List<AbstractExpression> combine_exps = new ArrayList<AbstractExpression>();
    final Map<AbstractExpression, AbstractExpression> combine_exps_left = new HashMap<AbstractExpression, AbstractExpression>();
    final Map<AbstractExpression, AbstractExpression> combine_exps_right = new HashMap<AbstractExpression, AbstractExpression>();
    for (int ctr = 0; ctr < num_of_subtrees; ctr++) {
        AbstractExpression exps[] = { new ComparisonExpression(ExpressionType.COMPARE_EQUAL),
                                      new ParameterValueExpression(),
                                      new TupleValueExpression()
        };
        exps[0].setLeft(exps[1]);
        exps[0].setRight(exps[2]);
        //ExpressionUtil.generateIds(exps[0]);
        combine_exps.add(exps[0]);
        combine_exps_left.put(exps[0], exps[1]);
        combine_exps_right.put(exps[0], exps[2]);
    } // FOR

    AbstractExpression combined_exp = null;
    try {
        combined_exp = ExpressionUtil.combine(combine_exps);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    assertNotNull(combined_exp);
    assertEquals(combined_exp.getExpressionType(), ExpressionType.CONJUNCTION_AND);
    //System.err.println(combined_exp.toString(true));

    //
    // Checking whether this worked is a bit tricky because the ordering of the may
    // be different if the implementation changges. So we just need to check to make
    // sure that all of our sub-trees are contained within the new tree and that their
    // structure has not changed
    //
    new TestExpressionTreeWalker() {
        @Override
        public void callback(AbstractExpression exp) {
            //
            // This node was in our original tree
            //
            if (combine_exps.contains(exp)) {
                assertTrue(combine_exps_left.containsKey(exp));
                TestExpressionUtil.compareExpressions(exp.getLeft(), combine_exps_left.get(exp));
                assertTrue(combine_exps_right.containsKey(exp));
                TestExpressionUtil.compareExpressions(exp.getRight(), combine_exps_right.get(exp));
                //
                // Make sure our parent is a CONJUNCTION_AND expression node
                //
                assertNotNull(this.getParent());
                assertEquals(this.getParent().getExpressionType(), ExpressionType.CONJUNCTION_AND);
            //
            // If this is a CONJUNCTION_AND that we added, make sure that both of its
            // children are not null
            //
            } else if (exp.getExpressionType() == ExpressionType.CONJUNCTION_AND) {
                assertNotNull(exp.getLeft());
                assertNotNull(exp.getRight());
            }
        }
    }.traverse(combined_exp);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:70,代码来源:TestExpressionUtil.java

示例8: extractStartFromPrefixLike

import org.voltdb.expressions.ComparisonExpression; //导入依赖的package包/类
public IndexableExpression extractStartFromPrefixLike() {
    ComparisonExpression gteFilter = m_filter.getGteFilterFromPrefixLike();
    return new IndexableExpression(null, gteFilter, m_bindings);
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:5,代码来源:SubPlanAssembler.java

示例9: extractEndFromPrefixLike

import org.voltdb.expressions.ComparisonExpression; //导入依赖的package包/类
public IndexableExpression extractEndFromPrefixLike() {
    ComparisonExpression ltFilter = m_filter.getLtFilterFromPrefixLike();
    return new IndexableExpression(null, ltFilter, m_bindings);
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:5,代码来源:SubPlanAssembler.java


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