docs: public static StmtOutput execute(StmtInput stmtInput) throws SFException,
                                                                 SnowflakeSQLException
    {
      HttpPost httpRequest = null;
  
      AssertUtil.assertTrue(stmtInput.serverUrl != null,
                            "Missing server url for statement execution");
  
      AssertUtil.assertTrue(stmtInput.sql != null,
                            "Missing sql for statement execution");
  
      AssertUtil.assertTrue(stmtInput.requestId != null,
                            "Missing request id for statement execution");
  
      AssertUtil.assertTrue(stmtInput.sequenceId >= 0,
                            "Negative sequence id for statement execution");
  
      AssertUtil.assertTrue(stmtInput.mediaType != null,
                            "Missing media type for statement execution");
  
      try
      {
        String resultAsString = null;
  
        // SNOW-20443: if we are retrying and there is get result URL, we
        // don't need to execute the query again
        if (stmtInput.retry && stmtInput.prevGetResultURL != null)
        {
          logger.debug(
              "retrying statement execution with get result URL: {}",
              stmtInput.prevGetResultURL);
        }
        else
        {
          URIBuilder uriBuilder = new URIBuilder(stmtInput.serverUrl);
  
          uriBuilder.setPath(SF_PATH_QUERY_V1);
          uriBuilder.addParameter(SF_QUERY_REQUEST_ID, stmtInput.requestId);
  
          if (stmtInput.combineDescribe)
          {
            uriBuilder.addParameter(SF_QUERY_COMBINE_DESCRIBE_EXECUTE, "true");
          }
  
          httpRequest = new HttpPost(uriBuilder.build());
  
          /**
           * sequence id is only needed for old query API, when old query API
           * is deprecated, we can remove sequence id.
           */
          QueryExecDTO sqlJsonBody = new QueryExecDTO(
              stmtInput.sql,
              stmtInput.describeOnly,
              stmtInput.sequenceId,
              stmtInput.bindValues,
              stmtInput.bindStage,
              stmtInput.parametersMap,
              stmtInput.querySubmissionTime,
              stmtInput.describeOnly || stmtInput.internal);
  
          if (stmtInput.combineDescribe && !stmtInput.describeOnly)
          {
            sqlJsonBody.setDescribedJobId(stmtInput.describedJobId);
          }
  
          String json = mapper.writeValueAsString(sqlJsonBody);
  
          if (logger.isDebugEnabled())
          {
            logger.debug("JSON: {}", json);
          }
  
          // SNOW-18057: compress the post body in gzip
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          GZIPOutputStream gzos = new GZIPOutputStream(baos);
          byte[] bytes = json.getBytes("UTF-8");
          gzos.write(bytes);
          gzos.finish();
          ByteArrayEntity input = new ByteArrayEntity(baos.toByteArray());
          input.setContentType("application/json");
          httpRequest.setEntity(input);
          httpRequest.addHeader("content-encoding", "gzip");
  
          httpRequest.addHeader("accept", stmtInput.mediaType);
  
          httpRequest.setHeader(SF_HEADER_AUTHORIZATION,
                                SF_HEADER_SNOWFLAKE_AUTHTYPE + " " + SF_HEADER_TOKEN_TAG
                                + "=\"" + stmtInput.sessionToken + "\"");
  
          setServiceNameHeader(stmtInput, httpRequest);
          eventHandler.triggerStateTransition(BasicEvent.QueryState.SENDING_QUERY,
                                              String.format(QueryState.SENDING_QUERY.getArgString(), stmtInput.requestId));
  
          resultAsString =
              HttpUtil.executeRequest(httpRequest,
                                      stmtInput.networkTimeoutInMillis / 1000,
                                      stmtInput.injectSocketTimeout,
                                      stmtInput.canceling,
                                      true // include retry parameters
              );
        }
  
        return pollForOutput(resultAsString, stmtInput, httpRequest);
      }
      catch (Exception ex)
      {
        if (!(ex instanceof SnowflakeSQLException))
        {
          if (ex instanceof IOException)
          {
            logger.error("IOException encountered", ex);
  
            // network error
            throw new SFException(ex, ErrorCode.NETWORK_ERROR,
                                  "Exception encountered when executing statement: " +
                                  ex.getLocalizedMessage());
          }
          else
          {
            logger.error("Exception encountered", ex);
  
            // raise internal exception if this is not a snowflake exception
            throw new SFException(ex, ErrorCode.INTERNAL_ERROR,
                                  ex.getLocalizedMessage());
          }
        }
        else
        {
          throw (SnowflakeSQLException) ex;
        }
      }
      finally
      {
        // we can release the http connection now
        if (httpRequest != null)
        {
          httpRequest.releaseConnection();
        }
      }
    }