@Test
  public void testSelect() throws ParseException {
    parse("select key, (c_int+1)+2 as x, sum(c_int) from \"c/b/o_t1\" group by c_float, \"c/b/o_t1\".c_int, key");
    parse("select x, y, count(*) from (select key, (c_int+c_float+1+2) as x, sum(c_int) as y from \"c/b/o_t1\" group by c_float, \"c/b/o_t1\".c_int, key) R group by y, x");
    parse("select \"cbo_/t3////\".c_int, c, count(*) from (select key as a, c_int+1 as b, sum(c_int) as c from \"c/b/o_t1\" where (\"c/b/o_t1\".c_int + 1 >= 0) and (\"c/b/o_t1\".c_int > 0 or \"c/b/o_t1\".c_float >= 0) group by c_float, \"c/b/o_t1\".c_int, key order by a) \"c/b/o_t1\" join (select key as p, c_int+1 as q, sum(c_int) as r from \"//cbo_t2\" where (\"//cbo_t2\".c_int + 1 >= 0) and (\"//cbo_t2\".c_int > 0 or \"//cbo_t2\".c_float >= 0)  group by c_float, \"//cbo_t2\".c_int, key order by q/10 desc, r asc) \"//cbo_t2\" on \"c/b/o_t1\".a=p join \"cbo_/t3////\" on \"c/b/o_t1\".a=key where (b + \"//cbo_t2\".q >= 0) and (b > 0 or c_int >= 0) group by \"cbo_/t3////\".c_int, c order by \"cbo_/t3////\".c_int+c desc, c");
    parse("select \"cbo_/t3////\".c_int, c, count(*) from (select key as a, c_int+1 as b, sum(c_int) as c from \"c/b/o_t1\" where (\"c/b/o_t1\".c_int + 1 >= 0) and (\"c/b/o_t1\".c_int > 0 or \"c/b/o_t1\".c_float >= 0)  group by c_float, \"c/b/o_t1\".c_int, key having \"c/b/o_t1\".c_float > 0 and (c_int >=1 or c_float >= 1) and (c_int + c_float) >= 0 order by b % c asc, b desc) \"c/b/o_t1\" left outer join (select key as p, c_int+1 as q, sum(c_int) as r from \"//cbo_t2\" where (\"//cbo_t2\".c_int + 1 >= 0) and (\"//cbo_t2\".c_int > 0 or \"//cbo_t2\".c_float >= 0)  group by c_float, \"//cbo_t2\".c_int, key  having \"//cbo_t2\".c_float > 0 and (c_int >=1 or c_float >= 1) and (c_int + c_float) >= 0) \"//cbo_t2\" on \"c/b/o_t1\".a=p left outer join \"cbo_/t3////\" on \"c/b/o_t1\".a=key where (b + \"//cbo_t2\".q >= 0) and (b > 0 or c_int >= 0) group by \"cbo_/t3////\".c_int, c  having \"cbo_/t3////\".c_int > 0 and (c_int >=1 or c >= 1) and (c_int + c) >= 0  order by \"cbo_/t3////\".c_int % c asc, \"cbo_/t3////\".c_int desc");
    parse("select \"cbo_/t3////\".c_int, c, count(*) from (select key as a, c_int+1 as b, sum(c_int) as c from \"c/b/o_t1\" where (\"c/b/o_t1\".c_int + 1 >= 0) and (\"c/b/o_t1\".c_int > 0 or \"c/b/o_t1\".c_float >= 0)  group by c_float, \"c/b/o_t1\".c_int, key having \"c/b/o_t1\".c_float > 0 and (c_int >=1 or c_float >= 1) and (c_int + c_float) >= 0 order by b+c, a desc) \"c/b/o_t1\" right outer join (select key as p, c_int+1 as q, sum(c_int) as r from \"//cbo_t2\" where (\"//cbo_t2\".c_int + 1 >= 0) and (\"//cbo_t2\".c_int > 0 or \"//cbo_t2\".c_float >= 0)  group by c_float, \"//cbo_t2\".c_int, key having \"//cbo_t2\".c_float > 0 and (c_int >=1 or c_float >= 1) and (c_int + c_float) >= 0) \"//cbo_t2\" on \"c/b/o_t1\".a=p right outer join \"cbo_/t3////\" on \"c/b/o_t1\".a=key where (b + \"//cbo_t2\".q >= 2) and (b > 0 or c_int >= 0) group by \"cbo_/t3////\".c_int, c");
    parse("select \"cbo_/t3////\".c_int, c, count(*) from (select key as a, c_int+1 as b, sum(c_int) as c from \"c/b/o_t1\" where (\"c/b/o_t1\".c_int + 1 >= 0) and (\"c/b/o_t1\".c_int > 0 or \"c/b/o_t1\".c_float >= 0)  group by c_float, \"c/b/o_t1\".c_int, key having \"c/b/o_t1\".c_float > 0 and (c_int >=1 or c_float >= 1) and (c_int + c_float) >= 0 order by c+a desc) \"c/b/o_t1\" full outer join (select key as p, c_int+1 as q, sum(c_int) as r from \"//cbo_t2\" where (\"//cbo_t2\".c_int + 1 >= 0) and (\"//cbo_t2\".c_int > 0 or \"//cbo_t2\".c_float >= 0)  group by c_float, \"//cbo_t2\".c_int, key having \"//cbo_t2\".c_float > 0 and (c_int >=1 or c_float >= 1) and (c_int + c_float) >= 0 order by p+q desc, r asc) \"//cbo_t2\" on \"c/b/o_t1\".a=p full outer join \"cbo_/t3////\" on \"c/b/o_t1\".a=key where (b + \"//cbo_t2\".q >= 0) and (b > 0 or c_int >= 0) group by \"cbo_/t3////\".c_int, c having \"cbo_/t3////\".c_int > 0 and (c_int >=1 or c >= 1) and (c_int + c) >= 0 order by \"cbo_/t3////\".c_int");
    parse("select \"cbo_/t3////\".c_int, c, count(*) from (select key as a, c_int+1 as b, sum(c_int) as c from \"c/b/o_t1\" where (\"c/b/o_t1\".c_int + 1 >= 0) and (\"c/b/o_t1\".c_int > 0 or \"c/b/o_t1\".c_float >= 0)  group by c_float, \"c/b/o_t1\".c_int, key having \"c/b/o_t1\".c_float > 0 and (c_int >=1 or c_float >= 1) and (c_int + c_float) >= 0) \"c/b/o_t1\" join (select key as p, c_int+1 as q, sum(c_int) as r from \"//cbo_t2\" where (\"//cbo_t2\".c_int + 1 >= 0) and (\"//cbo_t2\".c_int > 0 or \"//cbo_t2\".c_float >= 0)  group by c_float, \"//cbo_t2\".c_int, key having \"//cbo_t2\".c_float > 0 and (c_int >=1 or c_float >= 1) and (c_int + c_float) >= 0) \"//cbo_t2\" on \"c/b/o_t1\".a=p join \"cbo_/t3////\" on \"c/b/o_t1\".a=key where (b + \"//cbo_t2\".q >= 0) and (b > 0 or c_int >= 0) group by \"cbo_/t3////\".c_int, c");
  }
Parser tests special character in table names.
parser/src/test/org/apache/hadoop/hive/ql/parse/TestSpecialCharacterInTableNamesQuotes.java