Package org.voltdb.expressions

Examples of org.voltdb.expressions.AggregateExpression


    /**
     * testClone
     */
    @Test
    public void testClone() throws Exception {
        AggregateExpression exp = new AggregateExpression(ExpressionType.COMPARE_EQUAL);
        exp.m_distinct = true;
        AggregateExpression clone = (AggregateExpression)exp.clone();
        assertNotNull(clone);
       
        assertEquals(exp.getId(), clone.getId());
        assertEquals(exp.isJoiningClause(), clone.isJoiningClause());
        assertEquals(exp.getExpressionType(), clone.getExpressionType());
        assertEquals(exp.getValueType(), clone.getValueType());
        assertEquals(exp.getValueSize(), clone.getValueSize());
        assertEquals(exp.isDistinct(), clone.isDistinct());
    }
View Full Code Here


        // Expression implementations.

        if (expr instanceof AggregateExpression) {
            Node node;
            if ((node = attrs.getNamedItem("distinct")) != null) {
                AggregateExpression ae = (AggregateExpression)expr;
                ae.m_distinct = Boolean.parseBoolean(node.getNodeValue());
            }
        }

        // setup for children access
View Full Code Here

            AbstractExpression aggExpr = itr.next();
            assert(aggExpr instanceof AggregateExpression);
            if (aggExpr.getExpressionType() == ExpressionType.AGGREGATE_AVG) {
                itr.remove();

                AbstractExpression left = new AggregateExpression(ExpressionType.AGGREGATE_SUM);
                left.setLeft(aggExpr.getLeft());
                AbstractExpression right = new AggregateExpression(ExpressionType.AGGREGATE_COUNT);
                right.setLeft(aggExpr.getLeft());

                optimalAvgAggs.add(left);
                optimalAvgAggs.add(right);
            }
        }
View Full Code Here

        if (childExpr == null) {
            assert(exprType == ExpressionType.AGGREGATE_COUNT);
            exprType = ExpressionType.AGGREGATE_COUNT_STAR;
        }

        AggregateExpression expr = new AggregateExpression(exprType);
        expr.setLeft(childExpr);

        String node;
        if ((node = exprNode.attributes.get("distinct")) != null && Boolean.parseBoolean(node)) {
            expr.setDistinct();
        }
        return expr;
    }
View Full Code Here

                continue;
            }
            if (dcol.expression instanceof AggregateExpression == false) {
                return false;
            }
            AggregateExpression aggExpr = (AggregateExpression) dcol.expression;
            if (aggExpr.getLeft() instanceof TupleValueExpression == false) {
                return false;
            }
            ExpressionType type = aggExpr.getExpressionType();
            TupleValueExpression tve = (TupleValueExpression) aggExpr.getLeft();
            String columnName = tve.getColumnName();

            if (type != ExpressionType.AGGREGATE_SUM && type != ExpressionType.AGGREGATE_MIN
                    && type != ExpressionType.AGGREGATE_MAX) {
                return false;
View Full Code Here

TOP

Related Classes of org.voltdb.expressions.AggregateExpression

Copyright © 2018 www.massapicom. 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.