Examples of GroupBy


Examples of org.apache.phoenix.compile.GroupByCompiler.GroupBy

        if (table.getViewStatement() != null) {
            viewWhere = new SQLParser(table.getViewStatement()).parseQuery().getWhere();
        }
        Integer limit = LimitCompiler.compile(context, select);

        GroupBy groupBy = GroupByCompiler.compile(context, select);
        // Optimize the HAVING clause by finding any group by expressions that can be moved
        // to the WHERE clause
        select = HavingCompiler.rewrite(context, select, groupBy);
        Expression having = HavingCompiler.compile(context, select, groupBy);
        // Don't pass groupBy when building where clause expression, because we do not want to wrap these
View Full Code Here

Examples of org.apache.phoenix.compile.GroupByCompiler.GroupBy

        if (tableRef.getTable().getType() == PTableType.INDEX && tableRef.getTable().getIndexState() != PIndexState.ACTIVE) {
            return new DegenerateQueryPlan(context, select, tableRef);
        }
        Integer limit = LimitCompiler.compile(context, select);

        GroupBy groupBy = GroupByCompiler.compile(context, select);
        // Optimize the HAVING clause by finding any group by expressions that can be moved
        // to the WHERE clause
        select = HavingCompiler.rewrite(context, select, groupBy);
        Expression having = HavingCompiler.compile(context, select, groupBy);
        // Don't pass groupBy when building where clause expression, because we do not want to wrap these
View Full Code Here

Examples of org.apache.phoenix.compile.GroupByCompiler.GroupBy

        PhoenixConnection pconn = DriverManager.getConnection(getUrl(), TEST_PROPERTIES).unwrap(PhoenixConnection.class);
        ColumnResolver resolver = FromCompiler.getResolver(statement, pconn);
        statement = StatementNormalizer.normalize(statement, resolver);
        context = new StatementContext(statement, pconn, resolver, binds, scan);

        GroupBy groupBy = GroupByCompiler.compile(context, statement);
        // Optimize the HAVING clause by finding any group by expressions that can be moved
        // to the WHERE clause
        statement = HavingCompiler.rewrite(context, statement, groupBy);
        Expression having = HavingCompiler.compile(context, statement, groupBy);
        Expression where = WhereCompiler.compile(context, statement);
View Full Code Here

Examples of org.apache.phoenix.compile.GroupByCompiler.GroupBy

        statement = StatementNormalizer.normalize(statement, resolver);
        StatementContext context = new StatementContext(statement, pconn, resolver, binds, scan);

        Integer actualLimit = LimitCompiler.compile(context, statement);
        assertEquals(limit, actualLimit);
        GroupBy groupBy = GroupByCompiler.compile(context, statement);
        statement = HavingCompiler.rewrite(context, statement, groupBy);
        WhereCompiler.compileWhereClause(context, statement, extractedNodes);
        return context;
    }
View Full Code Here

Examples of org.apache.phoenix.compile.GroupByCompiler.GroupBy

        ColumnResolver resolver = FromCompiler.getResolver(statement, pconn);
        statement = StatementNormalizer.normalize(statement, resolver);
        StatementContext context = new StatementContext(statement, pconn, resolver, binds, scan);

        Integer limit = LimitCompiler.compile(context, statement);
        GroupBy groupBy = GroupByCompiler.compile(context, statement);
        statement = HavingCompiler.rewrite(context, statement, groupBy);
        HavingCompiler.compile(context, statement, groupBy);
        Expression where = WhereCompiler.compile(context, statement);
        assertNull(where);
        return limit;
View Full Code Here

Examples of org.apache.phoenix.compile.GroupByCompiler.GroupBy

        statement = StatementNormalizer.normalize(statement, resolver);
        StatementContext context = new StatementContext(statement, pconn, resolver, binds, scan);

        Integer actualLimit = LimitCompiler.compile(context, statement);
        assertEquals(limit, actualLimit);
        GroupBy groupBy = GroupByCompiler.compile(context, statement);
        statement = HavingCompiler.rewrite(context, statement, groupBy);
        WhereCompiler.compileWhereClause(context, statement, extractedNodes);
        return context;
    }
View Full Code Here

Examples of org.apache.phoenix.compile.GroupByCompiler.GroupBy

        if (table.getViewStatement() != null) {
            viewWhere = new SQLParser(table.getViewStatement()).parseQuery().getWhere();
        }
        Integer limit = LimitCompiler.compile(context, select);

        GroupBy groupBy = GroupByCompiler.compile(context, select);
        // Optimize the HAVING clause by finding any group by expressions that can be moved
        // to the WHERE clause
        select = HavingCompiler.rewrite(context, select, groupBy);
        Expression having = HavingCompiler.compile(context, select, groupBy);
        // Don't pass groupBy when building where clause expression, because we do not want to wrap these
View Full Code Here

Examples of org.codehaus.jparsec.examples.sql.ast.GroupBy

        new AliasedRelation(table("table1"), "t1"), table("t2"));
  }
 
  public void testGroupByClause() {
    Parser<GroupBy> parser = RelationParser.groupByClause(NUMBER, NUMBER);
    assertParser(parser, "group by 1, 2", new GroupBy(Arrays.asList(number(1), number(2)), null));
    assertParser(parser, "group by 1, 2 having 3",
        new GroupBy(Arrays.asList(number(1), number(2)), number(3)));
  }
View Full Code Here

Examples of org.codehaus.jparsec.examples.sql.ast.GroupBy

            number(1), null, null));
    assertParser(parser, "select 1 as id from t group by 2, 3",
        new Select(false,
            Arrays.asList(new Projection(number(1), "id")),
            Arrays.asList(table("t")),
            null, new GroupBy(Arrays.asList(number(2), number(3)), null), null));
    assertParser(parser, "select 1 as id from t group by 2, 3 having 4",
        new Select(false,
            Arrays.asList(new Projection(number(1), "id")),
            Arrays.asList(table("t")),
            null, new GroupBy(Arrays.asList(number(2), number(3)), number(4)), null));
    assertParser(parser, "select 1 as id from t order by 2 asc, 3 desc",
        new Select(false,
            Arrays.asList(new Projection(number(1), "id")),
            Arrays.asList(table("t")),
            null, null, new OrderBy(Arrays.asList(
View Full Code Here

Examples of org.codehaus.jparsec.examples.sql.ast.GroupBy

  }

  @Test
  public void testGroupByClause() {
    Parser<GroupBy> parser = RelationParser.groupByClause(NUMBER, NUMBER);
    assertParser(parser, "group by 1, 2", new GroupBy(Arrays.asList(number(1), number(2)), null));
    assertParser(parser, "group by 1, 2 having 3",
        new GroupBy(Arrays.asList(number(1), number(2)), number(3)));
  }
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.