@Test
  public void testParseValuesAsSubQuery() throws Exception {
    ASTNode tree = parseDriver.parse("SELECT * FROM (VALUES(1,2,3),(4,5,6)) as foo", null).getTree();

    ASTNode queryNode = (ASTNode) tree.getChild(0);
    ASTNode fromNode = (ASTNode) queryNode.getChild(0);
    ASTNode subQueryNode = (ASTNode) fromNode.getChild(0);
    ASTNode subQueryQueryNode = (ASTNode) subQueryNode.getChild(0);

    assertEquals(EXPECTED_VALUES_CLAUSE_TREE, subQueryQueryNode.dump());
  }
Test cases for parse WITHIN GROUP clause syntax.
function(expression) WITHIN GROUP (ORDER BY sort_expression)
parser/src/test/org/apache/hadoop/hive/ql/parse/TestValuesClause.java