Class LazyThriftResult
java.lang.Object
com.databricks.jdbc.api.impl.LazyThriftResult
- All Implemented Interfaces:
IExecutionResult
-
Constructor Summary
ConstructorsConstructorDescriptionLazyThriftResult(TFetchResultsResp initialResponse, IDatabricksStatementInternal statement, IDatabricksSession session) Creates a new LazyThriftResult that lazily fetches data on demand. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this result and releases associated resources.longGets the chunk count.longGets the current row index (0-based).getObject(int columnIndex) Gets the value at the specified column index for the current row.longGets the number of rows in the current batch.longGets the total number of rows fetched from the server so far.booleanhasNext()Checks if there are more rows available without advancing the cursor.booleanChecks if all data has been fetched from the server.booleannext()Moves the cursor to the next row.
-
Constructor Details
-
LazyThriftResult
public LazyThriftResult(TFetchResultsResp initialResponse, IDatabricksStatementInternal statement, IDatabricksSession session) throws DatabricksSQLException Creates a new LazyThriftResult that lazily fetches data on demand.- Parameters:
initialResponse- the initial response from the serverstatement- the statement that generated this resultsession- the session to use for fetching additional data- Throws:
DatabricksSQLException- if the initial response cannot be processed
-
-
Method Details
-
getObject
Gets the value at the specified column index for the current row.- Specified by:
getObjectin interfaceIExecutionResult- Parameters:
columnIndex- the zero-based column index- Returns:
- the value at the specified column
- Throws:
DatabricksSQLException- if the result is closed, cursor is invalid, or column index is out of bounds
-
getCurrentRow
public long getCurrentRow()Gets the current row index (0-based). Returns -1 if before the first row.- Specified by:
getCurrentRowin interfaceIExecutionResult- Returns:
- the current row index
-
next
Moves the cursor to the next row. Fetches additional data from server if needed.- Specified by:
nextin interfaceIExecutionResult- Returns:
- true if there is a next row, false if at the end
- Throws:
DatabricksSQLException- if an error occurs while fetching data
-
hasNext
public boolean hasNext()Checks if there are more rows available without advancing the cursor.- Specified by:
hasNextin interfaceIExecutionResult- Returns:
- true if there are more rows, false otherwise
-
close
public void close()Closes this result and releases associated resources.- Specified by:
closein interfaceIExecutionResult
-
getRowCount
public long getRowCount()Gets the number of rows in the current batch.- Specified by:
getRowCountin interfaceIExecutionResult- Returns:
- the number of rows in the current batch
-
getChunkCount
public long getChunkCount()Gets the chunk count. Always returns 0 for thrift columnar results.- Specified by:
getChunkCountin interfaceIExecutionResult- Returns:
- 0 (thrift results don't use chunks like Arrow)
-
getTotalRowsFetched
public long getTotalRowsFetched()Gets the total number of rows fetched from the server so far. This is different from getRowCount() which returns current batch size.- Returns:
- the total number of rows fetched from the server
-
isCompletelyFetched
public boolean isCompletelyFetched()Checks if all data has been fetched from the server.- Returns:
- true if all data has been fetched (either reached end or maxRows limit)
-