public void execBoolSql(HplsqlParser.Bool_exprContext ctx) {
    StringBuilder sql = new StringBuilder();
    if (ctx.T_OPEN_P() != null) {
      if (ctx.T_NOT() != null) {
        sql.append(ctx.T_NOT().getText() + " ");
      }
      sql.append("(");
      sql.append(evalPop(ctx.bool_expr(0)).toString());
      sql.append(")");
    }
    else if (ctx.bool_expr_atom() != null) {
      sql.append(evalPop(ctx.bool_expr_atom()).toString());
    }
    else if (ctx.bool_expr_logical_operator() != null) {
      sql.append(evalPop(ctx.bool_expr(0)).toString());
      sql.append(" " + ctx.bool_expr_logical_operator().getText() + " ");
      sql.append(evalPop(ctx.bool_expr(1)).toString());
    }
    exec.stackPush(sql);
  }
Evaluate a boolean expression in executable SQL statement
hplsql/src/main/java/org/apache/hive/hplsql/Expression.java