code: static protected String getQueryResult(String getResultPath,
                                           StmtInput stmtInput)
    throws SFException, SnowflakeSQLException
    {
      HttpGet httpRequest = null;
      logger.debug("get query result: {}", getResultPath);
  
      try
      {
        URIBuilder uriBuilder = new URIBuilder(stmtInput.serverUrl);
  
        uriBuilder.setPath(getResultPath);
  
        uriBuilder.addParameter(SF_QUERY_REQUEST_ID,
                                UUID.randomUUID().toString());
  
        httpRequest = new HttpGet(uriBuilder.build());
  
        httpRequest.addHeader("accept", stmtInput.mediaType);
  
        httpRequest.setHeader(SF_HEADER_AUTHORIZATION,
                              SF_HEADER_SNOWFLAKE_AUTHTYPE + " " + SF_HEADER_TOKEN_TAG
                              + "=\"" + stmtInput.sessionToken + "\"");
  
        setServiceNameHeader(stmtInput, httpRequest);
  
        return HttpUtil.executeRequest(httpRequest,
                                       stmtInput.networkTimeoutInMillis / 1000,
                                       0,
                                       stmtInput.canceling);
      }
      catch (URISyntaxException | IOException ex)
      {
        logger.error("Exception encountered when getting result for "
                     + httpRequest, ex);
  
        // raise internal exception if this is not a snowflake exception
        throw new SFException(ex, ErrorCode.INTERNAL_ERROR,
                              ex.getLocalizedMessage());
      }
    }
docs: Issue get-result call to get query result given an in-progress response.
  <p>
  
  @param getResultPath path to results
  @param stmtInput     object with context information
  @return results in string form
  @throws SFException           exception raised from Snowflake components
  @throws SnowflakeSQLException exception raised from Snowflake components