Examples of SimpleColumn


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

    Query query = QueryBuilder.getInstance().parseQuery(
        " SELECT a, min(c1), b, avg(c2) group by a,b pivot  c,d");
    QuerySelection selection = query.getSelection();
    QueryGroup group = query.getGroup();
    QueryPivot pivot = query.getPivot();
    assertEquals(Lists.newArrayList(new SimpleColumn("a"),
        new AggregationColumn(new SimpleColumn("c1"), AggregationType.MIN),
        new SimpleColumn("b"),
        new AggregationColumn(new SimpleColumn("c2"), AggregationType.AVG)),
        selection.getColumns());
    assertEquals(Lists.newArrayList("a", "b"), group.getColumnIds());
    assertEquals(Lists.newArrayList("c", "d"), pivot.getColumnIds());
  }
View Full Code Here

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

        " SELECT `a, b`, avg, min(min), max(max) group by `a, b`, avg "
            + " pivot count");
    QuerySelection selection = query.getSelection();
    QueryGroup group = query.getGroup();
    QueryPivot pivot = query.getPivot();
    assertEquals(Lists.newArrayList(new SimpleColumn("a, b"),
        new SimpleColumn("avg"),
        new AggregationColumn(new SimpleColumn("min"), AggregationType.MIN),
        new AggregationColumn(new SimpleColumn("max"), AggregationType.MAX)),
        selection.getColumns());
    assertEquals(Lists.newArrayList("a, b", "avg"), group.getColumnIds());
    assertEquals(Lists.newArrayList("count"), pivot.getColumnIds());
  }
View Full Code Here

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

  // LABEL clause tests

  public void testOneValidLabelWithDoubleQuotes() throws Exception {
    Query query = QueryBuilder.getInstance().parseQuery("select c1 label c1 \"Label 1\" ");
    QueryLabels labels = query.getLabels();
    assertEquals("Label 1", labels.getLabel(new SimpleColumn("c1")));
  }
View Full Code Here

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

  }

  public void testOneValidLabelWithSingleQuote() throws Exception {
    Query query = QueryBuilder.getInstance().parseQuery("select c1 label c1 'Label 1' ");
    QueryLabels labels = query.getLabels();
    assertEquals("Label 1", labels.getLabel(new SimpleColumn("c1")));
  }
View Full Code Here

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

  public void testTwoValidLabels() throws Exception {
    Query query = QueryBuilder.getInstance().parseQuery(
        "select c1,c2 label c1 'Label 1', c2 'Label 2' ");
    QueryLabels labels = query.getLabels();
    assertEquals("Label 1", labels.getLabel(new SimpleColumn("c1")));
    assertEquals("Label 2", labels.getLabel(new SimpleColumn("c2")));
  }
View Full Code Here

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

  // FORMAT clause tests

  public void testOneValidFormatWithDoubleQuotes() throws Exception {
    Query query = QueryBuilder.getInstance().parseQuery("select c1 Format c1 \"Format 1\" ");
    QueryFormat formats = query.getUserFormatOptions();
    assertEquals("Format 1", formats.getPattern(new SimpleColumn("c1")));
  }
View Full Code Here

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

  }

  public void testOneValidFormatWithSingleQuote() throws Exception {
    Query query = QueryBuilder.getInstance().parseQuery("select c1 Format c1 'Format 1' ");
    QueryFormat formats = query.getUserFormatOptions();
    assertEquals("Format 1", formats.getPattern(new SimpleColumn("c1")));
  }
View Full Code Here

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

  public void testTwoValidFormats() throws Exception {
    Query query = QueryBuilder.getInstance().parseQuery(
        "select c1,c2 Format c1 'Format 1', c2 'Format 2' ");
    QueryFormat formats = query.getUserFormatOptions();
    assertEquals("Format 1", formats.getPattern(new SimpleColumn("c1")));
    assertEquals("Format 2", formats.getPattern(new SimpleColumn("c2")));
  }
View Full Code Here

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

  public void testSimpleGroupAndPivot() throws Exception {
    Query query = QueryBuilder.getInstance().parseQuery("select min(salary), "
        + "avg(height) group by dept, subdept pivot year, month");
    assertEquals(Lists.<AbstractColumn>newArrayList(
        new AggregationColumn(new SimpleColumn("salary"), AggregationType.MIN),
        new AggregationColumn(new SimpleColumn("height"), AggregationType.AVG)),
        query.getSelection().getColumns());
    assertEquals(Lists.newArrayList("dept", "subdept"),
        query.getGroup().getColumnIds());
    assertEquals(Lists.newArrayList("year", "month"),
        query.getPivot().getColumnIds());
View Full Code Here

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

  }

  public void testSelectionOfArithmeticExpressions() throws Exception {
    Query query = QueryBuilder.getInstance().parseQuery("SELECT ((c1+c2)/c3*c4)-(c5/c6+year(c7))");
    ScalarFunctionColumn col1 = new ScalarFunctionColumn(
        Lists.<AbstractColumn>newArrayList(new SimpleColumn("c1"),
            new SimpleColumn("c2")), Sum.getInstance());
    ScalarFunctionColumn col2 = new ScalarFunctionColumn(
        Lists.<AbstractColumn>newArrayList(col1, new SimpleColumn("c3")),
        Quotient.getInstance());
    ScalarFunctionColumn col3 = new ScalarFunctionColumn(
        Lists.<AbstractColumn>newArrayList(col2, new SimpleColumn("c4")),
        Product.getInstance());
    ScalarFunctionColumn col4 = new ScalarFunctionColumn(
        Lists.<AbstractColumn>newArrayList(new SimpleColumn("c5"),
            new SimpleColumn("c6")), Quotient.getInstance());
    ScalarFunctionColumn col5 = new ScalarFunctionColumn(
        Lists.<AbstractColumn>newArrayList(col4,
            new ScalarFunctionColumn(Lists.<AbstractColumn>newArrayList(
                new SimpleColumn("c7")), TimeComponentExtractor.getInstance(
                TimeComponentExtractor.TimeComponent.YEAR))),
        Sum.getInstance());
    ScalarFunctionColumn col6 = new ScalarFunctionColumn(
        Lists.<AbstractColumn>newArrayList(col3, col5),
        Difference.getInstance());
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.