@Test
  public void test1() throws ParseException {
    //testing MATCHED AND with CASE statement
    ASTNode ast = parse(//using target.a breaks this
      "MERGE INTO target USING source ON target.pk = source.pk WHEN MATCHED " +
        "AND source.c2 < current_time() " +
        "THEN UPDATE set a = source.b, b = case when c1 is null then c1 else c1 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_matched " +
            "(tok_update " +
              "(tok_set_columns_clause " +
                "(= (tok_table_or_col a) (. (tok_table_or_col source) b)) " +
                "(= (tok_table_or_col b) (tok_function when (tok_function isnull (tok_table_or_col c1)) (tok_table_or_col c1) (tok_table_or_col c1)))" +
              ")" +
            ") " +
          "(< (. (tok_table_or_col source) c2) (tok_function current_time)))" +
        ")", ast.toStringTree());
  }
Testing parsing for SQL Merge statement
parser/src/test/org/apache/hadoop/hive/ql/parse/TestMergeStatement.java