當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。