docs: protected CompletableFuture<ClientResponse> runNonDDLAdHoc(CatalogContext context,
                                                                 List<String> sqlStatements,
                                                                 boolean inferPartitioning,
                                                                 Object userPartitionKey,
                                                                 ExplainMode explainMode,
                                                                 boolean isLargeQuery,
                                                                 boolean isSwapTables,
                                                                 Object[] userParamSet)
      {
          // record the catalog version the query is planned against to
          // catch races vs. updateApplicationCatalog.
          if (context == null) {
              context = VoltDB.instance().getCatalogContext();
          }
  
          List<String> errorMsgs = new ArrayList<>();
          List<AdHocPlannedStatement> stmts = new ArrayList<>();
          int partitionParamIndex = -1;
          VoltType partitionParamType = null;
          Object partitionParamValue = null;
          assert(sqlStatements != null);
  
          boolean inferSP = (sqlStatements.size() == 1) && inferPartitioning;
  
          if (userParamSet != null && userParamSet.length > 0) {
              if (sqlStatements.size() != 1) {
                  return makeQuickResponse(ClientResponse.GRACEFUL_FAILURE,
                                           AdHocErrorResponseMessage);
              }
          }
  
          for (final String sqlStatement : sqlStatements) {
              try {
                  AdHocPlannedStatement result = compileAdHocSQL(context.m_ptool,
                                                                 sqlStatement,
                                                                 inferSP,
                                                                 userPartitionKey,
                                                                 explainMode,
                                                                 isLargeQuery,
                                                                 isSwapTables,
                                                                 userParamSet);
                  // The planning tool may have optimized for the single partition case
                  // and generated a partition parameter.
                  if (inferSP) {
                      partitionParamIndex = result.getPartitioningParameterIndex();
                      partitionParamType = result.getPartitioningParameterType();
                      partitionParamValue = result.getPartitioningParameterValue();
                  }
                  stmts.add(result);
              }
              catch (AdHocPlanningException e) {
                  errorMsgs.add(e.getMessage());
              }
          }
  
          if (!errorMsgs.isEmpty()) {
              String errorSummary = StringUtils.join(errorMsgs, "\n");
              return makeQuickResponse(ClientResponse.GRACEFUL_FAILURE, errorSummary);
          }
  
          AdHocPlannedStmtBatch plannedStmtBatch =
                  new AdHocPlannedStmtBatch(userParamSet,
                                            stmts,
                                            partitionParamIndex,
                                            partitionParamType,
                                            partitionParamValue,
                                            userPartitionKey == null ? null : new Object[] { userPartitionKey });
  
          if (adhocLog.isDebugEnabled()) {
              logBatch(context, plannedStmtBatch, userParamSet);
          }
  
          final VoltTrace.TraceEventBatch traceLog = VoltTrace.log(VoltTrace.Category.CI);
          if (traceLog != null) {
              traceLog.add(() -> VoltTrace.endAsync("planadhoc", getClientHandle()));
          }
  
          if (explainMode == ExplainMode.EXPLAIN_ADHOC) {
              return processExplainPlannedStmtBatch(plannedStmtBatch);
          }
          else if (explainMode == ExplainMode.EXPLAIN_DEFAULT_PROC) {
              return processExplainDefaultProc(plannedStmtBatch);
          }
          else if (explainMode == ExplainMode.EXPLAIN_JSON) {
              return processExplainPlannedStmtBatchInJSON(plannedStmtBatch);
          }
          else {
              try {
                  return createAdHocTransaction(plannedStmtBatch, isSwapTables);
              }
              catch (VoltTypeException vte) {
                  String msg = "Unable to execute adhoc sql statement(s): " + vte.getMessage();
                  return makeQuickResponse(ClientResponse.GRACEFUL_FAILURE, msg);
              }
          }
      }