Examples of ExpressionType


Examples of org.voltdb.types.ExpressionType

// boolean has_count = (clone_types.contains(ExpressionType.AGGREGATE_COUNT) ||
// clone_types.contains(ExpressionType.AGGREGATE_COUNT_STAR));

        int orig_cnt = clone_types.size();
        for (int i = 0; i < orig_cnt; i++) {
            ExpressionType cloneType = clone_types.get(i);
            // Ok, strap on your helmets boys, here's what we got going on here...
            // In order to do a distributed average, we need to send the average
            // AND the count (in order to compute the weight average at the base partition).
            // We need check whether we already have a count already in our list
            // If not, then we'll want to insert it here.
            if (cloneType == ExpressionType.AGGREGATE_AVG) {
                if (has_count == false) {
                    // But now because we add a new output column that we're going to use internally,
                    // we need to make sure that our output columns reflect this.
                    clone_types.add(ExpressionType.AGGREGATE_COUNT_STAR);
                    has_count = true;
                   
                    // Aggregate Input Column
                    // We just need to do it against the first column in the child's output
                    // Picking the column that we want to use doesn't matter even if there is a GROUP BY
                    clone_agg.getAggregateColumnGuids().add(node.getChild(0).getOutputColumnGUID(0));

                    // Aggregate Output Column
                    TupleValueExpression exp = new TupleValueExpression();
                    exp.setValueType(VoltType.BIGINT);
                    exp.setValueSize(VoltType.BIGINT.getLengthInBytesForFixedTypes());
                    exp.setTableName(PlanAssembler.AGGREGATE_TEMP_TABLE);
                    exp.setColumnName("");
                    exp.setColumnAlias("_DTXN_COUNT");
                    exp.setColumnIndex(clone_agg.getOutputColumnGUIDCount());
                    PlanColumn new_pc = state.plannerContext.getPlanColumn(exp, exp.getColumnAlias());
                    clone_agg.getAggregateOutputColumns().add(clone_agg.getOutputColumnGUIDCount());
                    clone_agg.getAggregateColumnNames().add(new_pc.getDisplayName());
                    clone_agg.getOutputColumnGUIDs().add(new_pc.guid());
                }
            }
        } // FOR
       
        // Now go through the original AggregateNode (the one at the top of tree)
        // and change the ExpressiontTypes for the aggregates to handle ahat we're
        // doing down below in the distributed query
        List<ExpressionType> exp_types = node.getAggregateTypes();
        exp_types.clear();
        for (int i = 0; i < orig_cnt; i++) {
            ExpressionType cloneType = clone_types.get(i);
            switch (cloneType) {
                case AGGREGATE_COUNT:
                case AGGREGATE_COUNT_STAR:
                case AGGREGATE_SUM:
                    exp_types.add(ExpressionType.AGGREGATE_SUM);
View Full Code Here

Examples of org.voltdb.types.ExpressionType

    /**
     * testGetScanExpressionTypes
     */
    @Test
    public void testGetScanExpressionTypes() throws Exception {
        ExpressionType expected[] = {
            ExpressionType.COMPARE_EQUAL,
            ExpressionType.VALUE_PARAMETER,
            ExpressionType.VALUE_TUPLE,
        };
       
View Full Code Here

Examples of org.voltdb.types.ExpressionType

        VoltType retType = VoltType.INVALID;
        int retSize = 0;
        //
        // First get the value types for the left and right children
        //
        ExpressionType exp_type = exp.getExpressionType();
        AbstractExpression left_exp = exp.getLeft();
        AbstractExpression right_exp = exp.getRight();

        // -------------------------------
        // CONSTANT/NULL/PARAMETER/TUPLE VALUES
View Full Code Here

Examples of org.voltdb.types.ExpressionType

            int outputColumnIndex = 0;
            for (ParsedSelectStmt.ParsedColInfo col : m_parsedSelect.displayColumns) {

                AbstractExpression rootExpr = col.expression;
                ExpressionType agg_expression_type = rootExpr.getExpressionType();
                if (rootExpr.getExpressionType() == ExpressionType.AGGREGATE_SUM ||
                    rootExpr.getExpressionType() == ExpressionType.AGGREGATE_MIN ||
                    rootExpr.getExpressionType() == ExpressionType.AGGREGATE_MAX ||
                    rootExpr.getExpressionType() == ExpressionType.AGGREGATE_AVG ||
                    rootExpr.getExpressionType() == ExpressionType.AGGREGATE_COUNT ||
View Full Code Here

Examples of org.voltdb.types.ExpressionType

    }

    abstract protected void loadFromJSONObject(JSONObject obj, Database db) throws JSONException;

    public static AbstractExpression fromJSONObject(JSONObject obj, Database db) throws JSONException {
        ExpressionType type = ExpressionType.valueOf(obj.getString(Members.TYPE.name()));
        AbstractExpression expr;
        try {
            expr = type.getExpressionClass().newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
            return null;
        } catch (IllegalAccessException e) {
            e.printStackTrace();
View Full Code Here

Examples of org.voltdb.types.ExpressionType

     * @param db
     * @return
     */
    AbstractExpression parseOperationExpression(Node exprNode, NamedNodeMap attrs, Database db) {
        String type = attrs.getNamedItem("type").getNodeValue();
        ExpressionType exprType = ExpressionType.get(type);
        AbstractExpression expr = null;

        if (exprType == ExpressionType.INVALID) {
            throw new PlanningErrorException("Unsupported operation type '" + type + "'");
        }
        try {
            expr = exprType.getExpressionClass().newInstance();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
        expr.setExpressionType(exprType);
View Full Code Here

Examples of org.voltdb.types.ExpressionType

        m_valueSize = m_valueType.getLengthInBytesForFixedTypes();
    }

    @Override
    public String explain(String impliedTableName) {
        ExpressionType type = getExpressionType();
        return "(" + m_left.explain(impliedTableName) +
            " " + type.symbol() + " " +
            m_right.explain(impliedTableName) + ")";
    }
View Full Code Here

Examples of org.voltdb.types.ExpressionType

        reverses.put(ExpressionType.COMPARE_LESSTHANOREQUALTO, ExpressionType.COMPARE_GREATERTHANOREQUALTO);
        reverses.put(ExpressionType.COMPARE_GREATERTHANOREQUALTO, ExpressionType.COMPARE_LESSTHANOREQUALTO);
    }

    public ComparisonExpression reverseOperator() {
        ExpressionType reverseType = reverses.get(this.m_type);
        // Left and right exprs are reversed on purpose
        return new ComparisonExpression(reverseType, m_right, m_left);
    }
View Full Code Here

Examples of org.voltdb.types.ExpressionType

        return ender;
    }

    /// Construct the lower bound comparison filter implied by a prefix LIKE comparison.
    public ComparisonExpression getGteFilterFromPrefixLike() {
        ExpressionType rangeComparator = ExpressionType.COMPARE_GREATERTHANOREQUALTO;
        String comparand = extractLikePatternPrefix();
        return rangeFilterFromPrefixLike(m_left, rangeComparator, comparand);
    }
View Full Code Here

Examples of org.voltdb.types.ExpressionType

        return rangeFilterFromPrefixLike(m_left, rangeComparator, comparand);
    }

    /// Construct the upper bound comparison filter implied by a prefix LIKE comparison.
    public ComparisonExpression getLtFilterFromPrefixLike() {
        ExpressionType rangeComparator = ExpressionType.COMPARE_LESSTHAN;
        String comparand = extractAndIncrementLikePatternPrefix();
        return rangeFilterFromPrefixLike(m_left, rangeComparator, comparand);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.