Class ThriftBatchFetcherImpl
- java.lang.Object
-
- com.databricks.jdbc.api.impl.thrift.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 Summary
Constructors Constructor Description ThriftBatchFetcherImpl(IDatabricksSession session, IDatabricksStatementInternal statement)Creates a new ThriftBatchFetcherImpl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the fetcher and releases any associated resources.TFetchResultsRespfetchNextBatch()Fetches the next batch of results from the server.booleanisClosed()Checks if the fetcher has been closed.
-
-
-
Constructor Detail
-
ThriftBatchFetcherImpl
public ThriftBatchFetcherImpl(IDatabricksSession session, IDatabricksStatementInternal statement)
Creates a new ThriftBatchFetcherImpl.- Parameters:
session- The session to use for fetchingstatement- The statement that generated the result
-
-
Method Detail
-
fetchNextBatch
public TFetchResultsResp fetchNextBatch() throws SQLException
Description copied from interface:ThriftBatchFetcherFetches 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:
fetchNextBatchin interfaceThriftBatchFetcher- 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:ThriftBatchFetcherCloses the fetcher and releases any associated resources.After calling close(), any subsequent calls to fetchNextBatch() should throw an exception.
- Specified by:
closein interfaceThriftBatchFetcher
-
isClosed
public boolean isClosed()
Description copied from interface:ThriftBatchFetcherChecks if the fetcher has been closed.- Specified by:
isClosedin interfaceThriftBatchFetcher- Returns:
- true if close() has been called
-
-