@Test
  public void test4() throws ParseException {
    ASTNode
      ast = parse(
      "MERGE INTO target USING source ON target.pk = source.pk WHEN NOT MATCHED THEN INSERT VALUES(source.a, case when source.b is null then target.b else source.b end)");
    Assert.assertEquals(
      "(tok_merge " +
        "(tok_tabref (tok_tabname target)) (tok_tabref (tok_tabname source)) (= (. (tok_table_or_col target) pk) (. (tok_table_or_col source) pk)) " +
        "(tok_not_matched " +
          "(tok_insert " +
            "(tok_function struct " +
              "(. (tok_table_or_col source) a) " +
                "(tok_function when " +
                  "(tok_function isnull (. (tok_table_or_col source) b)) (. (tok_table_or_col target) b) " +
                  "(. (tok_table_or_col source) b)" +
                ")" +
              ")" +
          ")" +
        ")" +
      ")", ast.toStringTree());

  }
Testing parsing for SQL Merge statement
parser/src/test/org/apache/hadoop/hive/ql/parse/TestMergeStatement.java