Ejemplo n.º 1
0
  @Test
  public void testGroupByRollup() {
    GroupSymbolImpl g = getFactory().newGroupSymbol("m.g"); // $NON-NLS-1$
    FromImpl from = getFactory().newFrom();
    from.addGroup(g);

    SelectImpl select = getFactory().newSelect();
    select.addSymbol(getFactory().newElementSymbol("a")); // $NON-NLS-1$

    GroupByImpl groupBy = getFactory().newGroupBy();
    groupBy.setRollup(true);
    groupBy.addSymbol(getFactory().newElementSymbol("b")); // $NON-NLS-1$
    groupBy.addSymbol(getFactory().newElementSymbol("c")); // $NON-NLS-1$

    QueryImpl query = getFactory().newQuery();
    query.setSelect(select);
    query.setFrom(from);
    query.setGroupBy(groupBy);
    helpTest(
        "SELECT a FROM m.g GROUP BY rollup(b, c)", //$NON-NLS-1$
        "SELECT a FROM m.g GROUP BY ROLLUP(b, c)", //$NON-NLS-1$
        query);
  }