@Test
  public void testTestGroupByIsEmptyAndThereIsNoOtherColsInAggr() throws ParseException {
    parse("select unionsrc.key FROM (select 'tst1' as key, count(1) as value from default.src) unionsrc");
    parse("select unionsrc.key, unionsrc.value FROM (select 'tst1' as key, count(1) as value from default.src) unionsrc");

    parse("select unionsrc.key FROM (select 'max' as key, max(c_int) as value from `cbo_/t3////` s1\n" +
        "\n" +
        "UNION  ALL\n" +
        "\n" +
        "    select 'min' as key,  min(c_int) as value from `cbo_/t3////` s2\n" +
        "\n" +
        "    UNION ALL\n" +
        "\n" +
        "        select 'avg' as key,  avg(c_int) as value from `cbo_/t3////` s3) unionsrc order by unionsrc.key");

    parse("select unionsrc.key, unionsrc.value FROM (select 'max' as key, max(c_int) as value from `cbo_/t3////` s1\n" +
        "\n" +
        "UNION  ALL\n" +
        "\n" +
        "    select 'min' as key,  min(c_int) as value from `cbo_/t3////` s2\n" +
        "\n" +
        "    UNION ALL\n" +
        "\n" +
        "        select 'avg' as key,  avg(c_int) as value from `cbo_/t3////` s3) unionsrc order by unionsrc.key");

    parse("select unionsrc.key, count(1) FROM (select 'max' as key, max(c_int) as value from `cbo_/t3////` s1\n" +
        "\n" +
        "    UNION  ALL\n" +
        "\n" +
        "        select 'min' as key,  min(c_int) as value from `cbo_/t3////` s2\n" +
        "\n" +
        "    UNION ALL\n" +
        "\n" +
        "        select 'avg' as key,  avg(c_int) as value from `cbo_/t3////` s3) unionsrc group by unionsrc.key order by unionsrc.key");
  }
Parser tests special character in table names.
parser/src/test/org/apache/hadoop/hive/ql/parse/TestSpecialCharacterInTableNames.java