docs: private StmtTargetTableScan simplifierForSubquery(AbstractParsedStmt subquery) {
          // Must be a SELECT statement (not a SET operation)
          if (!(subquery instanceof ParsedSelectStmt)) {
              return null;
          }
          ParsedSelectStmt selectSubquery = (ParsedSelectStmt) subquery;
          // No aggregation and/or GROUP BY is allowed
          if (selectSubquery.hasAggregateOrGroupby()) {
              return null;
          }
          // No DISTINCT
          if (selectSubquery.hasAggregateDistinct()) {
              return null;
          }
          // No windowed aggregate functions like RANK.
          if (selectSubquery.hasWindowFunctionExpression()) {
              return null;
          }
          // No LIMIT/OFFSET
          if (selectSubquery.hasLimitOrOffset() || selectSubquery.hasLimitOrOffsetParameters()) {
              return null;
          }
          // Only SELECT from a single TARGET TABLE is allowed
          int tableCount = 0;
          StmtTargetTableScan simpler = null;
          for (Map.Entry<String, StmtTableScan> entry : selectSubquery.getScanEntrySet()) {
              if (entry.getKey().startsWith(AbstractParsedStmt.TEMP_TABLE_NAME)) {
                  // This is an artificial table for a subquery expression
                  continue;
              }
              if (++tableCount > 1) {
                  return null;
              }
              // Only allow one TARGET TABLE, not a nested subquery.
              StmtTableScan scan = entry.getValue();
              if (scan instanceof StmtTargetTableScan) {
                  simpler = (StmtTargetTableScan) scan;
              }
              else {
                  return null;
              }
          }
          return simpler;
      }