docs: private AbstractExpression optimizeInExpressions(AbstractExpression expr) {
          ExpressionType exprType = expr.getExpressionType();
          if (ExpressionType.CONJUNCTION_AND == exprType || ExpressionType.CONJUNCTION_OR == exprType) {
              AbstractExpression optimizedLeft = optimizeInExpressions(expr.getLeft());
              expr.setLeft(optimizedLeft);
              AbstractExpression optimizedRight = optimizeInExpressions(expr.getRight());
              expr.setRight(optimizedRight);
              return expr;
          }
  
          if (ExpressionType.COMPARE_EQUAL != exprType) {
              return expr;
          }
  
          assert(expr instanceof ComparisonExpression);
          if (((ComparisonExpression)expr).getQuantifier() != QuantifierType.ANY) {
              return expr;
          }
  
          /*
           * Verify that an IN expression can be safely converted to an EXISTS one
           * IN (SELECT" forms e.g. "(A, B) IN (SELECT X, Y, FROM ...) =>
           * EXISTS (SELECT 42 FROM ... AND|WHERE|HAVING A=X AND|WHERE|HAVING B=Y)
           */
          AbstractExpression inColumns = expr.getLeft();
          if (inColumns instanceof SelectSubqueryExpression) {
              // If the left child is a (SELECT ...) expression itself we can't convert it
              // to the EXISTS expression because the mandatory run time scalar check -
              // (expression must return a single row at most)
              return expr;
          }
  
          // The right hand operand of the equality operation must be a SELECT statement
          AbstractExpression rightExpr = expr.getRight();
          if (!(rightExpr instanceof SelectSubqueryExpression)) {
              return expr;
          }
  
          SelectSubqueryExpression subqueryExpr = (SelectSubqueryExpression) rightExpr;
          AbstractParsedStmt subquery = subqueryExpr.getSubqueryStmt();
          if (!(subquery instanceof ParsedSelectStmt)) {
              return expr;
          }
  
          ParsedSelectStmt selectStmt = (ParsedSelectStmt) subquery;
  
          // Must not have OFFSET or LIMIT set
          // EXISTS (select * from T where T.X = parent.X order by T.Y offset 10 limit 5)
          //      seems to require 11 matches
          // parent.X IN (select T.X from T order by T.Y offset 10 limit 5)
          //      seems to require 1 match that has exactly 10-14 rows (matching or not) with lesser or equal values of Y.
          if (selectStmt.hasLimitOrOffset()) {
              return expr;
          }
  
          ParsedSelectStmt.rewriteInSubqueryAsExists(selectStmt, inColumns);
          subqueryExpr.resolveCorrelations();
          AbstractExpression existsExpr = new OperatorExpression();
          existsExpr.setExpressionType(ExpressionType.OPERATOR_EXISTS);
          existsExpr.setLeft(subqueryExpr);
          return optimizeExistsExpression(existsExpr);
      }