docs: SFBaseResultSet executeQueryInternal(
        String sql,
        Map<String, ParameterBindingDTO> parameterBindings,
        boolean describeOnly,
        boolean internal,
        CallingMethod caller)
    throws SQLException, SFException
    {
      resetState();
  
      if (logger.isDebugEnabled())
      {
        logger.debug("executeQuery: {}", SecretDetector.maskAWSSecret(sql));
      }
  
      if (session == null || session.isClosed())
      {
        throw new SQLException("connection is closed");
      }
  
      Object result = executeHelper(sql,
                                    StmtUtil.SF_MEDIA_TYPE,
                                    parameterBindings,
                                    describeOnly,
                                    internal);
  
      if (result == null)
      {
        throw new SnowflakeSQLException(SqlState.INTERNAL_ERROR,
                                        ErrorCode.INTERNAL_ERROR.getMessageCode(),
                                        "got null result");
      }
  
      /*
       * we sort the result if the connection is in sorting mode
       */
      Object sortProperty = session.getSFSessionProperty("sort");
  
      boolean sortResult = sortProperty != null && (Boolean) sortProperty;
  
      logger.debug("Creating result set");
  
      try
      {
        JsonNode jsonResult = (JsonNode) result;
        resultSet = new SFResultSet(jsonResult, this, sortResult);
        childResults = ResultUtil.getChildResults(session, requestId, jsonResult);
  
        // if child results are available, skip over this result set and set the
        // current result to the first child's result.
        // we still construct the first result set for its side effects.
        if (!childResults.isEmpty())
        {
          SFStatementType type = childResults.get(0).type;
  
          // ensure first query type matches the calling JDBC method, if exists
          if (caller == CallingMethod.EXECUTE_QUERY && !type.isGenerateResultSet())
          {
            throw new SnowflakeSQLException(
                ErrorCode.QUERY_FIRST_RESULT_NOT_RESULT_SET);
          }
          else if (caller == CallingMethod.EXECUTE_UPDATE && type.isGenerateResultSet())
          {
            throw new SnowflakeSQLException(
                ErrorCode.UPDATE_FIRST_RESULT_NOT_UPDATE_COUNT);
          }
  
          // this will update resultSet to point to the first child result before we return it
          getMoreResults();
        }
      }
      catch (SnowflakeSQLException | OutOfMemoryError ex)
      {
        // snow-24428: no need to generate incident for exceptions we generate
        // snow-29403: or client OOM
        throw ex;
      }
      catch (Throwable ex)
      {
        // SNOW-22813 log exception
        logger.error("Exception creating result", ex);
  
        throw (SFException) IncidentUtil.generateIncidentV2WithException(
            session,
            new SFException(ErrorCode.INTERNAL_ERROR,
                            IncidentUtil.oneLiner("exception creating result", ex)),
            null,
            null);
      }
      logger.debug("Done creating result set");
  
      return resultSet;
    }