public void execSimpleCaseSql(HplsqlParser.Expr_case_simpleContext ctx) { 
    StringBuilder sql = new StringBuilder();
    sql.append("CASE ");
    sql.append(evalPop(ctx.expr(0)).toString());
    int cnt = ctx.T_WHEN().size();
    for (int i = 0; i < cnt; i++) {
      sql.append(" WHEN ");
      sql.append(evalPop(ctx.expr(i * 2 + 1)).toString());
      sql.append(" THEN ");
      sql.append(evalPop(ctx.expr(i * 2 + 2)).toString());
    }
    if (ctx.T_ELSE() != null) {
      sql.append(" ELSE ");
      sql.append(evalPop(ctx.expr(cnt * 2 + 1)).toString());
    }
    sql.append(" END");
    exec.stackPush(sql);
  }
Simple CASE expression in executable SQL statement
hplsql/src/main/java/org/apache/hive/hplsql/Expression.java