core/src/test/java/org/apache/hop/core/sql/SqlTest.java
@Test
  public void testSql07() throws Exception {
    IRowMeta rowMeta = generateServiceRowMeta();

    String sqlString =
        "select \"Service\".\"Category\" as \"c0\" from \"Service\" as \"Service\" group by \"Service\".\"Category\" "
            + "order by CASE WHEN \"Service\".\"Category\" IS NULL THEN 1 ELSE 0 END, \"Service\".\"Category\" ASC";

    Sql sql = new Sql(ThinUtil.stripNewlines(sqlString));

    assertEquals("Service", sql.getServiceName());
    sql.parse(rowMeta);

    assertFalse(sql.getSelectFields().isDistinct());
    List<SqlField> selectFields = sql.getSelectFields().getFields();
    assertEquals(1, selectFields.size());
    assertEquals("c0", selectFields.get(0).getAlias());

    List<SqlField> orderFields = sql.getOrderFields().getFields();
    assertEquals(2, orderFields.size());
  }
/**
   * Query generated by Mondrian / Analyzer.
   *
   * @throws Exception
   */
Query generated by Mondrian / Analyzer.
@throws Exception
Query generated by Mondrian / Analyzer . @throws Exception
@Test
  public void testSql07() throws Exception {
    IRowMeta rowMeta = generateServiceRowMeta();
    String sqlString =
        "select \"Service\".\"Category\" as \"c0\" from \"Service\" as \"Service\" group by \"Service\".\"Category\" "
            + "order by CASE WHEN \"Service\".\"Category\" IS NULL THEN 1 ELSE 0 END, \"Service\".\"Category\" ASC";
    Sql sql = new Sql(ThinUtil.stripNewlines(sqlString));
    assertEquals("Service", sql.getServiceName());
    sql.parse(rowMeta);
    assertFalse(sql.getSelectFields().isDistinct());
    List<SqlField> selectFields = sql.getSelectFields().getFields();
    assertEquals(1, selectFields.size());
    assertEquals("c0", selectFields.get(0).getAlias());
    List<SqlField> orderFields = sql.getOrderFields().getFields();
    assertEquals(2, orderFields.size());
  }
@ Test public void testSql07 ( ) throws Exception { IRowMeta rowMeta = generateServiceRowMeta ( ) ; String sqlString = "select \"Service\".\"Category\" as \"c0\" from \"Service\" as \"Service\" group by \"Service\".\"Category\" " + "order by CASE WHEN \"Service\".\"Category\" IS NULL THEN 1 ELSE 0 END, \"Service\".\"Category\" ASC" ; Sql sql = new Sql ( ThinUtil . stripNewlines ( sqlString ) ) ; assertEquals ( "Service" , sql . getServiceName ( ) ) ; sql . parse ( rowMeta ) ; assertFalse ( sql . getSelectFields ( ) . isDistinct ( ) ) ; List < SqlField > selectFields = sql . getSelectFields ( ) . getFields ( ) ; assertEquals ( 1 , selectFields . size ( ) ) ; assertEquals ( "c0" , selectFields . get ( 0 ) . getAlias ( ) ) ; List < SqlField > orderFields = sql . getOrderFields ( ) . getFields ( ) ; assertEquals ( 2 , orderFields . size ( ) ) ; }
Query generated by Mondrian / Analyzer.
Query generated by Mondrian / Analyzer .