Examples of SimpleColumn


Examples of com.google.visualization.datasource.query.SimpleColumn

    // day(hireDate) - hour(seniorityStartTime) < -5
    // group by day(hireDate) - hour(seniorityStartTime)
    Query q = new Query();

    AbstractColumn col1  = new ScalarFunctionColumn(
        Lists.<AbstractColumn>newArrayList(new SimpleColumn("hireDate")),
        TimeComponentExtractor.getInstance(
            TimeComponentExtractor.TimeComponent.DAY));
    AbstractColumn col2  = new ScalarFunctionColumn(
        Lists.<AbstractColumn>newArrayList(
            new SimpleColumn("seniorityStartTime")),
        TimeComponentExtractor.getInstance(
            TimeComponentExtractor.TimeComponent.HOUR));
    AbstractColumn col3 = new ScalarFunctionColumn(
        Lists.<AbstractColumn>newArrayList(col1, col2),
        Difference.getInstance());
View Full Code Here

Examples of com.google.visualization.datasource.query.SimpleColumn

    Query q = new Query();

    AbstractColumn col1 = new ScalarFunctionColumn(
        Lists.<AbstractColumn>newArrayList(), new Constant(new NumberValue(10)));
    AbstractColumn col2 = new ScalarFunctionColumn(
        Lists.<AbstractColumn>newArrayList(new SimpleColumn("weight"), col1),
        Modulo.getInstance());

    // Add selection
    QuerySelection selection = new QuerySelection();
    selection.addColumn(new SimpleColumn("weight"));
    selection.addColumn(col2);
    q.setSelection(selection);
   
    q.validate();
View Full Code Here

Examples of com.google.visualization.datasource.query.SimpleColumn

    // select name, weight where weight%2=0.0
    Query q = new Query();

    // Add selection
    QuerySelection selection = new QuerySelection();
    selection.addColumn(new SimpleColumn("name"));
    selection.addColumn(new SimpleColumn("weight"));
    q.setSelection(selection);

    AbstractColumn col1 = new ScalarFunctionColumn(
      Lists.<AbstractColumn>newArrayList(), new Constant(new NumberValue(2)));
    AbstractColumn col2 = new ScalarFunctionColumn(
      Lists.<AbstractColumn>newArrayList(new SimpleColumn("weight"), col1),
      Modulo.getInstance());

    QueryFilter filter = new ColumnValueFilter(col2,
      new NumberValue(0), ComparisonFilter.Operator.EQ);
    q.setFilter(filter);
View Full Code Here

Examples of com.google.visualization.datasource.query.SimpleColumn

    Query query = new Query();

    DataTable data = MockDataSource.getData(0);

    QuerySelection selection = new QuerySelection();
    selection.addColumn(new SimpleColumn("name"));
    selection.addColumn(new SimpleColumn("isAlive"));
    query.setSelection(selection);

    QueryLabels labels = new QueryLabels();
    labels.addLabel(new SimpleColumn("isAlive"),
        "New isAlive Label");
    query.setLabels(labels);

    DataTable res = QueryEngine.executeQuery(query, data, ULocale.US);
View Full Code Here

Examples of com.google.visualization.datasource.query.SimpleColumn

  public void testFormatAndLabelOnPivotColumns() throws Exception {
    Query query = new Query();
    QuerySelection selection = new QuerySelection(); // SELECT (sum(sales) / 7)
    List<AbstractColumn> columns = Lists.newArrayList();
    columns.add(new AggregationColumn(new SimpleColumn("Sales"), AggregationType.SUM));
    columns.add(new ScalarFunctionColumn(Lists.<AbstractColumn>newArrayList(),
        new Constant(new NumberValue(7))));
    AbstractColumn selectedColumn = new ScalarFunctionColumn(columns, Quotient.getInstance());
    selection.addColumn(selectedColumn);

    query.setSelection(selection);
    QueryGroup group = new QueryGroup();
    group.addColumn(new SimpleColumn("Year"));
    query.setGroup(group);
    QueryPivot pivot = new QueryPivot();
    pivot.addColumn(new SimpleColumn("Band"));
    pivot.addColumn(new SimpleColumn("Songs"));
    query.setPivot(pivot);
    QueryLabels labels = new QueryLabels();
    labels.addLabel(selectedColumn, "foo");
    query.setLabels(labels);
    QueryFormat format = new QueryFormat();
View Full Code Here

Examples of com.google.visualization.datasource.query.SimpleColumn

    DataTable table = new DataTable();
    table.addColumn(simpleColumnDescription);
    table.addColumn(aggreationColumnDescription);

    List<AbstractColumn> simpleColumns =
        Lists.newArrayList((AbstractColumn) new SimpleColumn("simpleColumn"));
    List<AbstractColumn> aggregationColumns =
        Lists.newArrayList((AbstractColumn) new AggregationColumn(
            new SimpleColumn("simpleColumn"), AggregationType.MIN));
    ScalarFunctionColumnTitle titleYear =
        new ScalarFunctionColumnTitle(Lists.<Value>newArrayList(),
            new ScalarFunctionColumn(simpleColumns,
                TimeComponentExtractor.getInstance(
                    TimeComponentExtractor.TimeComponent.YEAR)));
View Full Code Here

Examples of com.google.visualization.datasource.query.SimpleColumn

  public void testSelect() throws Exception {
    Query query = QueryBuilder.getInstance().parseQuery("SeLeCt  c1,c2  , c3 ");

    assertEquals(null, query.getSort());
    QuerySelection selection = query.getSelection();
    assertEquals(Lists.newArrayList(new SimpleColumn("c1"),
        new SimpleColumn("c2"), new SimpleColumn("c3")),
        selection.getColumns());
  }
View Full Code Here

Examples of com.google.visualization.datasource.query.SimpleColumn

    // Select aleph, bet, gimmel. (Hebrew).
    Query query = QueryBuilder.getInstance().parseQuery("SELECT `\u05d0`,`\u05d1`,`\u05d2` ");

    assertEquals(null, query.getSort());
    QuerySelection selection = query.getSelection();
    assertEquals(Lists.newArrayList(new SimpleColumn("\u05d0"),
        new SimpleColumn("\u05d1"), new SimpleColumn("\u05d2")),
        selection.getColumns());

    query = QueryBuilder.getInstance().parseQuery("SELECT * WHERE c='\u311e'");
    QueryFilter filter = query.getFilter();
    assertTrue(filter instanceof ColumnValueFilter);
View Full Code Here

Examples of com.google.visualization.datasource.query.SimpleColumn

        "OrDeR   bY  c1,c2 desc , c3 ASC");
    assertEquals(null, query.getSelection());
    QuerySort sort = query.getSort();
    List<ColumnSort> columnSorts = sort.getSortColumns();
    assertEquals(3, columnSorts.size());
    assertEquals(new SimpleColumn("c1"), columnSorts.get(0).getColumn());
    assertEquals(new SimpleColumn("c2"), columnSorts.get(1).getColumn());
    assertEquals(new SimpleColumn("c3"), columnSorts.get(2).getColumn());
    assertEquals(SortOrder.ASCENDING, columnSorts.get(0).getOrder());
    assertEquals(SortOrder.DESCENDING, columnSorts.get(1).getOrder());
    assertEquals(SortOrder.ASCENDING, columnSorts.get(2).getOrder());
  }
View Full Code Here

Examples of com.google.visualization.datasource.query.SimpleColumn

  public void testSelectAndOrderBy() throws Exception {
    Query query = QueryBuilder.getInstance().parseQuery(
        "SELect c1   ,    c2 , c3   ORDER BY c4 DESC");
    QuerySelection selection = query.getSelection();
    assertEquals(Lists.newArrayList(new SimpleColumn("c1"),
        new SimpleColumn("c2"), new SimpleColumn("c3")),
        selection.getColumns());
    QuerySort sort = query.getSort();
    List<ColumnSort> columnSorts = sort.getSortColumns();
    assertEquals(1, columnSorts.size());
    assertEquals(new SimpleColumn("c4"), columnSorts.get(0).getColumn());
    assertEquals(SortOrder.DESCENDING, columnSorts.get(0).getOrder());
  }
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.