Class ThriftBatchFetcherImpl

  • All Implemented Interfaces:
    ThriftBatchFetcher

    public class ThriftBatchFetcherImpl
    extends Object
    implements ThriftBatchFetcher
    Default implementation of ThriftBatchFetcher that uses the session's Databricks client to fetch batches.

    This implementation delegates to session.getDatabricksClient().getMoreResults() which uses Thrift's FETCH_NEXT orientation to retrieve sequential batches.

    • Constructor Detail

      • ThriftBatchFetcherImpl

        public ThriftBatchFetcherImpl​(IDatabricksSession session,
                                      IDatabricksStatementInternal statement)
        Creates a new ThriftBatchFetcherImpl.
        Parameters:
        session - The session to use for fetching
        statement - The statement that generated the result
    • Method Detail

      • fetchNextBatch

        public TFetchResultsResp fetchNextBatch()
                                         throws SQLException
        Description copied from interface: ThriftBatchFetcher
        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.

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

        public void close()
        Description copied from interface: ThriftBatchFetcher
        Closes the fetcher and releases any associated resources.

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

        Specified by:
        close in interface ThriftBatchFetcher
      • isClosed

        public boolean isClosed()
        Description copied from interface: ThriftBatchFetcher
        Checks if the fetcher has been closed.
        Specified by:
        isClosed in interface ThriftBatchFetcher
        Returns:
        true if close() has been called