Interface ThriftBatchFetcher

  • All Known Implementing Classes:
    ThriftBatchFetcherImpl

    public interface ThriftBatchFetcher
    Interface for fetching Thrift columnar result batches from the server.

    This abstraction enables testing with mock implementations and potential future enhancements like caching or instrumentation.

    Implementations must be thread-safe as the fetcher may be called from the prefetch thread while the main thread is consuming data.

    • Method Detail

      • fetchNextBatch

        TFetchResultsResp fetchNextBatch()
                                  throws SQLException
        Fetches the next batch of results from the server.

        This is a blocking network call that uses the Thrift FETCH_NEXT orientation. Each call returns the next sequential batch from the server's cursor.

        Thread Safety: This method should only be called from a single thread at a time, as the server maintains a cursor that advances with each call.

        Returns:
        The fetch response containing the batch data and hasMoreRows flag
        Throws:
        SQLException - if the fetch fails due to network or server errors
      • close

        void close()
        Closes the fetcher and releases any associated resources.

        After calling close(), any subsequent calls to fetchNextBatch() should throw an exception.

      • isClosed

        boolean isClosed()
        Checks if the fetcher has been closed.
        Returns:
        true if close() has been called