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


Java ExpressionType类代码示例

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


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

示例1: isRangeQuery

import org.voltdb.types.ExpressionType; //导入依赖的package包/类
/**
 * Returns true if the AbstractPlanNode contains a range query
 * @param rootNode
 * @return
 */
public static boolean isRangeQuery(AbstractPlanNode rootNode) {
    for (ExpressionType expType : getScanExpressionTypes(rootNode)) {
        switch (expType) {
            case COMPARE_GREATERTHAN:
            case COMPARE_GREATERTHANOREQUALTO:
            case COMPARE_IN:
            case COMPARE_LESSTHAN:
            case COMPARE_LESSTHANOREQUALTO:
            case COMPARE_LIKE:
            case CONJUNCTION_OR:
                return (true);
        } // SWITCH
    } // FOR
    return (false);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:21,代码来源:PlanNodeUtil.java

示例2: compareWithConstant

import org.voltdb.types.ExpressionType; //导入依赖的package包/类
/**
 * Handy method for creating a comparison expression between a tuple value
 * and a constant.
 *
 * @param <T>
 *            The type of the constant.
 * @param type
 *            The type of comparison.
 * @param left
 *            The name of the column of the left operand.
 * @param right
 *            The constant.
 * @return The expression representing the comparison operation.
 */
public static <T> Expression compareWithConstant(ExpressionType type,
                                                 String left,
                                                 T right) {
    switch (type) {
    case COMPARE_EQUAL:
        return new CompareEqual(value(left), constant(right));
    case COMPARE_NOTEQUAL:
        return new CompareNotEqual(value(left), constant(right));
    case COMPARE_GREATERTHAN:
        return new CompareGreaterThan(value(left), constant(right));
    case COMPARE_GREATERTHANOREQUALTO:
        return new CompareGreaterThanOrEqualTo(value(left), constant(right));
    case COMPARE_LESSTHAN:
        return new CompareLessThan(value(left), constant(right));
    case COMPARE_LESSTHANOREQUALTO:
        return new CompareLessThanOrEqualTo(value(left), constant(right));
    default:
        throw new IllegalArgumentException("Type must be a comparison type");
    }
}
 
开发者ID:s-store,项目名称:s-store,代码行数:35,代码来源:Verification.java

示例3: compareTupleValues

import org.voltdb.types.ExpressionType; //导入依赖的package包/类
/**
 * Handy method for creating a comparison expression between two tuple
 * values.
 *
 * @param type
 *            The type of comparison.
 * @param left
 *            The name of the column of the left operand.
 * @param right
 *            The name of the column of the right operand.
 * @return The expression representing the comparison operation.
 */
public static Expression compareTupleValues(ExpressionType type,
                                            String left,
                                            String right) {
    switch (type) {
    case COMPARE_EQUAL:
        return new CompareEqual(value(left), value(right));
    case COMPARE_NOTEQUAL:
        return new CompareNotEqual(value(left), value(right));
    case COMPARE_GREATERTHAN:
        return new CompareGreaterThan(value(left), value(right));
    case COMPARE_GREATERTHANOREQUALTO:
        return new CompareGreaterThanOrEqualTo(value(left), value(right));
    case COMPARE_LESSTHAN:
        return new CompareLessThan(value(left), value(right));
    case COMPARE_LESSTHANOREQUALTO:
        return new CompareLessThanOrEqualTo(value(left), value(right));
    default:
        throw new IllegalArgumentException("Type must be a comparison type");
    }
}
 
开发者ID:s-store,项目名称:s-store,代码行数:33,代码来源:Verification.java

示例4: validate

import org.voltdb.types.ExpressionType; //导入依赖的package包/类
@Override
public void validate() throws Exception {
    super.validate();
    //
    // We need to have an aggregate type and column
    // We're not checking that it's a valid ExpressionType because this plannode is a temporary hack
    //
    if (m_aggregateTypes.size() != m_aggregateColumnNames.size() ||
        m_aggregateColumnNames.size() != m_aggregateOutputColumns.size())
    {
        throw new Exception("ERROR: Mismatched number of aggregate expression column attributes for PlanNode '" + this + "'");
    } else if (m_aggregateTypes.isEmpty()|| m_aggregateTypes.contains(ExpressionType.INVALID)) {
        throw new Exception("ERROR: Invalid Aggregate ExpressionType or No Aggregate Expression types for PlanNode '" + this + "'");
    } else if (m_aggregateColumnNames.isEmpty()) {
        throw new Exception("ERROR: No Aggregate Columns for PlanNode '" + this + "'");
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:18,代码来源:AggregatePlanNode.java

示例5: conjunction

import org.voltdb.types.ExpressionType; //导入依赖的package包/类
/**
 * Handy method for creating a conjunction expression. Multiple expressions
 * can be given and they will all be joined with the same type.
 *
 * @param type
 *            The type of conjunction.
 * @param exps
 *            The expressions to conjunct.
 * @return The expression representing the conjunction.
 */
public static Expression conjunction(ExpressionType type, Expression... exps) {
    Expression prev = null;

    for (Expression exp : exps) {
        if (prev != null) {
            if (type == ExpressionType.CONJUNCTION_AND)
                prev = new ConjunctionAnd(prev, exp);
            else if (type == ExpressionType.CONJUNCTION_OR)
                prev = new ConjunctionOr(prev, exp);
            else
                throw new IllegalArgumentException("Type must be a conjunction type");
        } else {
            prev = exp;
        }
    }

    return prev;
}
 
开发者ID:s-store,项目名称:s-store,代码行数:29,代码来源:Verification.java

示例6: loadFromJSONObject

import org.voltdb.types.ExpressionType; //导入依赖的package包/类
@Override
protected void loadFromJSONObject(JSONObject obj, Database db) throws JSONException {
    JSONArray aggregateColumns = obj.getJSONArray(Members.AGGREGATE_COLUMNS.name());
    for (int ii = 0; ii < aggregateColumns.length(); ii++) {
        JSONObject aggregateColumn = aggregateColumns.getJSONObject(ii);
        m_aggregateTypes.add(ExpressionType.valueOf(aggregateColumn.getString(Members.AGGREGATE_TYPE.name())));
        m_aggregateColumnNames.add(aggregateColumn.getString(Members.AGGREGATE_NAME.name()));
        m_aggregateColumnGuids.add(aggregateColumn.getInt(Members.AGGREGATE_GUID.name()));
        m_aggregateOutputColumns.add(aggregateColumn.getInt(Members.AGGREGATE_OUTPUT_COLUMN.name()));
    }
    
    try {
        JSONArray groupbyColumnGuids = obj.getJSONArray(Members.GROUPBY_COLUMNS.name());
        for (int ii = 0; ii < groupbyColumnGuids.length(); ii++) {
            JSONObject jsonObject = groupbyColumnGuids.getJSONObject(ii);
            PlanColumn column = PlanColumn.fromJSONObject(jsonObject, db);
            m_groupByColumnGuids.add(column.guid());
        }
    } catch (JSONException e) {
        //okay not to be there.
    }
}
 
开发者ID:s-store,项目名称:s-store,代码行数:23,代码来源:AggregatePlanNode.java

示例7: getScanExpressionTypes

import org.voltdb.types.ExpressionType; //导入依赖的package包/类
/**
 * Return all the ExpressionTypes used for scan predicates in the given PlanNode
 * @param node
 * @return
 */
public static Collection<ExpressionType> getScanExpressionTypes(AbstractPlanNode root) {
    final Set<ExpressionType> found = new HashSet<ExpressionType>();
    new PlanNodeTreeWalker(true) {
        @Override
        protected void callback(AbstractPlanNode node) {
            Set<AbstractExpression> exps = new HashSet<AbstractExpression>();
            switch (node.getPlanNodeType()) {
                // SCANS
                case INDEXSCAN: {
                    IndexScanPlanNode idx_node = (IndexScanPlanNode) node;
                    exps.add(idx_node.getEndExpression());
                    exps.addAll(idx_node.getSearchKeyExpressions());
                }
                case SEQSCAN: {
                    AbstractScanPlanNode scan_node = (AbstractScanPlanNode) node;
                    exps.add(scan_node.getPredicate());
                    break;
                }
                // JOINS
                case NESTLOOP:
                case NESTLOOPINDEX: {
                    AbstractJoinPlanNode cast_node = (AbstractJoinPlanNode) node;
                    exps.add(cast_node.getPredicate());
                    break;
                }
                default:
                    // Do nothing...
            } // SWITCH

            for (AbstractExpression exp : exps) {
                if (exp == null)
                    continue;
                found.addAll(ExpressionUtil.getExpressionTypes(exp));
            } // FOR
            return;
        }
    }.traverse(root);
    return (found);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:45,代码来源:PlanNodeUtil.java

示例8: factory

import org.voltdb.types.ExpressionType; //导入依赖的package包/类
public static CatalogPair factory(CatalogType element0, CatalogType element1, ExpressionType comparison_exp, QueryType... query_types) {
    // Sort them!
    if (element0.compareTo(element1) > 0) {
        CatalogType temp = element0;
        element0 = element1;
        element1 = temp;
    }
    return (new CatalogPair(element0, element1, comparison_exp, query_types));
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:10,代码来源:CatalogPair.java

示例9: isEqualityIndexScan

import org.voltdb.types.ExpressionType; //导入依赖的package包/类
/**
 * Returns true if the given query is an equality predicate (with all the columns)
 * on a unique index. This essentially means that the query will only return
 * one row at runtime.
 * <B>WARNING:</B> This is wildly inaccurate and should not used by to make runtime decisions.
 * @param catalog_stmt
 * @return
 */
public static boolean isEqualityIndexScan(Statement catalog_stmt) {
    Collection<Table> tables = getReferencedTables(catalog_stmt);
    PredicatePairs cset = extractStatementPredicates(catalog_stmt, false, tables.toArray(new Table[0]));
    
    Collection<Index> indexes = getReferencedIndexes(catalog_stmt);
    
    for (CatalogPair cp : cset) {
        if (cp.getComparisonExp() != ExpressionType.COMPARE_EQUAL) {
            return (false);
        }
        
        CatalogType ctypes[] = { cp.getFirst(), cp.getSecond() };
        for (int i = 0; i < ctypes.length; i++) {
            if (ctypes[i] instanceof Column) {
                Column target_col = (Column)ctypes[i];
                Table target_tbl = target_col.getParent();

                // Find what index it's using
                // This is a rough approximation...
                Index target_idx = null;
                for (Index idx : indexes) {
                    if (idx.getParent().equals(target_tbl)) {
                        for (Column col : CatalogUtil.getColumns(idx.getColumns())) {
                            if (col.equals(target_col)) {
                                target_idx = idx;
                                break;
                            }
                        } // FOR
                    }
                } // FOR
                if (target_idx == null) {
                    return (false);
                }
            }
        } // FOR

    } // FOR
    return (true);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:48,代码来源:CatalogUtil.java

示例10: createTempExpression

import org.voltdb.types.ExpressionType; //导入依赖的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

示例11: getExpressionTypes

import org.voltdb.types.ExpressionType; //导入依赖的package包/类
/**
 * Get all of the ExpressionTypes used in the tree below the given root
 * 
 * @param root
 * @return
 */
public static Collection<ExpressionType> getExpressionTypes(AbstractExpression root) {
    final Set<ExpressionType> found = new HashSet<ExpressionType>();
    new ExpressionTreeWalker() {
        @Override
        protected void callback(AbstractExpression element) {
            found.add(element.getExpressionType());
        }
    }.traverse(root);
    return (found);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:17,代码来源:ExpressionUtil.java

示例12: add

import org.voltdb.types.ExpressionType; //导入依赖的package包/类
/**
 * @param element0
 * @param element1
 * @param comparison_exp
 * @param catalog_stmts
 * @return
 */
public boolean add(CatalogType element0, CatalogType element1, ExpressionType comparison_exp, Statement... catalog_stmts) {
    Set<Statement> stmts = new HashSet<Statement>();
    for (Statement stmt : catalog_stmts) {
        stmts.add(stmt);
    }
    return (this.add(element0, element1, comparison_exp, stmts));
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:15,代码来源:PredicatePairs.java

示例13: put

import org.voltdb.types.ExpressionType; //导入依赖的package包/类
/**
 * 
 * @param key
 * @param param
 * @param expType
 * @param catalog_tbl
 */
public void put(Column key, CatalogType param, ExpressionType expType, Table catalog_tbl) {
    assert(param instanceof StmtParameter || param instanceof ConstantValue);
    List<Pair<ExpressionType, CatalogType>> params = this.predicates.get(key);
    if (params == null) {
        params = new ArrayList<Pair<ExpressionType, CatalogType>>();
        this.predicates.put(key, params);
    }
    params.add(Pair.of(expType, param));
    this.table_keys.add(CatalogKey.createKey(catalog_tbl));
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:18,代码来源:PartitionEstimator.java

示例14: buildConstraints

import org.voltdb.types.ExpressionType; //导入依赖的package包/类
protected void buildConstraints() {
    Expression constraint = null;

    // PlayRound table 0: 0 <= C4 < 100 (max round is 100)
    constraint = Verification.inRange("C4", 0L, 99L);
    addConstraint("PlayRound", 0, constraint);

    // PlayRound table 1: 0 <= R_POT < 900 (because the max round is 100, we
    // only add at most 9 each time)
    Expression r_pot = Verification.inRange("R_POT", 0, 899);
    Expression t_id = Verification.compareWithConstant(ExpressionType.COMPARE_GREATERTHANOREQUALTO,
                                                       "T_ID", 0);
    Expression b_id = Verification.compareWithConstant(ExpressionType.COMPARE_GREATERTHANOREQUALTO,
                                                       "B_ID", 0);
    Expression r_id = Verification.compareWithConstant(ExpressionType.COMPARE_GREATERTHANOREQUALTO,
                                                       "R_ID", 0);
    constraint = Verification.conjunction(ExpressionType.CONJUNCTION_AND,
                                          r_pot, t_id, b_id, r_id);
    addConstraint("PlayRound", 1, constraint);

    // For the tables
    addConstraint("T", 0, t_id);

    constraint = Verification.conjunction(ExpressionType.CONJUNCTION_AND,
                                          t_id, b_id);
    addConstraint("B", 0, constraint);

    constraint = Verification.conjunction(ExpressionType.CONJUNCTION_AND,
                                          r_pot, t_id, r_id);
    addConstraint("R", 0, constraint);
}
 
开发者ID:s-store,项目名称:s-store,代码行数:32,代码来源:BingoClient.java

示例15: getTablesForExpression

import org.voltdb.types.ExpressionType; //导入依赖的package包/类
/**
 *
 * @param db
 * @param expr
 * @param tables
 */
void getTablesForExpression(Database db, AbstractExpression expr, HashSet<Table> tables) {
    if (expr.getLeft() != null)
        getTablesForExpression(db, expr.getLeft(), tables);
    if (expr.getRight() != null)
        getTablesForExpression(db, expr.getRight(), tables);
    if (expr.getExpressionType() == ExpressionType.VALUE_TUPLE) {
        TupleValueExpression tupleExpr = (TupleValueExpression)expr;
        String tableName = tupleExpr.getTableName();
        Table table = db.getTables().getIgnoreCase(tableName);
        tables.add(table);
    }
}
 
开发者ID:s-store,项目名称:s-store,代码行数:19,代码来源:AbstractParsedStmt.java


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