Examples of GroupBy


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.springframework.data.mongodb.core.mapreduce.GroupBy

  }

  @Test
  public void singleKeyCreation() {

    DBObject gc = new GroupBy("a").getGroupByObject();

    assertThat(gc.toString(), is("{ \"key\" : { \"a\" : 1} , \"$reduce\" :  null  , \"initial\" :  null }"));
  }
View Full Code Here

Examples of org.teiid.language.GroupBy

    public static GroupBy example() throws Exception {
        return TstLanguageBridgeFactory.factory.translate(helpExample());
    }

    public void testGetElements() throws Exception {
        GroupBy gb = example();
        assertNotNull(gb.getElements());
        assertEquals(4, gb.getElements().size());
        for (Iterator i = gb.getElements().iterator(); i.hasNext();) {
            assertTrue(i.next() instanceof ColumnReference);
        }
    }
View Full Code Here

Examples of org.teiid.query.sql.lang.GroupBy

            }
            case NodeConstants.Types.GROUP:
            {
                List groups = (List) node.getProperty(NodeConstants.Info.GROUP_COLS);
                if(groups != null && !groups.isEmpty()) {
                    query.setGroupBy(new GroupBy(groups));
                }
                break;
            }
            case NodeConstants.Types.TUPLE_LIMIT:
            {
View Full Code Here

Examples of org.teiid.query.sql.lang.GroupBy

                GroupsUsedByElementsVisitor.getGroups(orderBy, groups);
            }
        } else if(type == NodeConstants.Types.GROUP) { 
          List<SingleElementSymbol> groupCols = (List<SingleElementSymbol>)node.getProperty(NodeConstants.Info.GROUP_COLS);
            if (groupCols != null) {
                GroupBy groupBy= new GroupBy(groupCols);
                ExpressionMappingVisitor.mapExpressions(groupBy, symbolMap);
                node.setProperty(NodeConstants.Info.GROUP_COLS, groupBy.getSymbols());
                if (!singleMapping) {
                    GroupsUsedByElementsVisitor.getGroups(groupBy, groups);
                }
            }              
        } else if (type == NodeConstants.Types.SOURCE || type == NodeConstants.Types.ACCESS) {
View Full Code Here

Examples of org.teiid.query.sql.lang.GroupBy

    from.addGroup(g);

    Select select = new Select();
    select.addSymbol(new ElementSymbol("a", false)); //$NON-NLS-1$
   
    GroupBy groupBy = new GroupBy();
    groupBy.addSymbol(new ElementSymbol("b", false));     //$NON-NLS-1$
    groupBy.addSymbol(new ElementSymbol("c", false)); //$NON-NLS-1$
   

    Query query = new Query();
    query.setSelect(select);
    query.setFrom(from);
View Full Code Here

Examples of org.teiid.query.sql.lang.GroupBy

    from.addGroup(g);

    Select select = new Select();
    select.addSymbol(new ElementSymbol("a", false)); //$NON-NLS-1$
   
    GroupBy groupBy = new GroupBy();
    groupBy.addSymbol(new ElementSymbol("b", false));     //$NON-NLS-1$
    groupBy.addSymbol(new ElementSymbol("c", false)); //$NON-NLS-1$
   
    CompareCriteria having = new CompareCriteria(new ElementSymbol("b", false), CompareCriteria.EQ, new Constant(new Integer(5))); //$NON-NLS-1$
   
    Query query = new Query();
    query.setSelect(select);
View Full Code Here

Examples of org.teiid.query.sql.lang.GroupBy

    from.addGroup(g);

    Select select = new Select();
    select.addSymbol(new ElementSymbol("a")); //$NON-NLS-1$
   
    GroupBy groupBy = new GroupBy();
    groupBy.addSymbol(new ElementSymbol("a")); //$NON-NLS-1$
   
    Criteria having = new CompareCriteria(
      new AggregateSymbol("count", "COUNT", false, new ElementSymbol("b", false)), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
      CompareCriteria.GT,
      new Constant(new Integer(0)) );
View Full Code Here

Examples of org.teiid.query.sql.lang.GroupBy

    from.addGroup(g);

    Select select = new Select();
    select.addSymbol(new ElementSymbol("a")); //$NON-NLS-1$
   
    GroupBy groupBy = new GroupBy();
    groupBy.addSymbol(new ElementSymbol("a")); //$NON-NLS-1$
    groupBy.addSymbol(new ElementSymbol("b")); //$NON-NLS-1$
   
    CompoundCriteria having = new CompoundCriteria();
    having.setOperator(CompoundCriteria.AND);
    having.addCriteria(new CompareCriteria(
      new AggregateSymbol("count", "COUNT", false, new ElementSymbol("b", false)), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
View Full Code Here

Examples of org.teiid.query.sql.lang.GroupBy

      ArrayList<SingleElementSymbol> aggs = new ArrayList<SingleElementSymbol>();
      for (Expression expr : (List<Expression>)plannedResult.rightExpressions) {
        AggregateSymbolCollectorVisitor.getAggregates(expr, aggs, groupingSymbols);
      }
      if (!groupingSymbols.isEmpty()) {
        plannedResult.query.setGroupBy((GroupBy) new GroupBy(new ArrayList<SingleElementSymbol>(groupingSymbols)).clone());
      }
    }
    HashSet<SingleElementSymbol> projectedSymbols = new HashSet<SingleElementSymbol>();
    for (SingleElementSymbol ses : plannedResult.query.getProjectedSymbols()) {
      if (ses instanceof AliasSymbol) {
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.