Class ArrowStreamResult
- java.lang.Object
-
- com.databricks.jdbc.api.impl.arrow.ArrowStreamResult
-
- All Implemented Interfaces:
IExecutionResult
public class ArrowStreamResult extends Object implements IExecutionResult
Result container for Arrow-based query results.
-
-
Constructor Summary
Constructors Constructor Description ArrowStreamResult(TFetchResultsResp resultsResp, IDatabricksStatementInternal parentStatementId, IDatabricksSession session)ArrowStreamResult(ResultManifest resultManifest, ResultData resultData, StatementId statementId, IDatabricksSession session)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the result set and releases any in-memory chunks or dataList<String>getArrowMetadata()longgetChunkCount()ChunkProvidergetChunkProvider()Returns the chunk provider for testing purposes.longgetCurrentRow()Gets the current row position, starting with 0.ObjectgetObject(int columnIndex)Get the object for given column index.protected static ObjectgetObjectWithComplexTypeHandling(IDatabricksSession session, ArrowResultChunkIterator chunkIterator, int columnIndex, ColumnInfoTypeName requiredType, String arrowMetadata, ColumnInfo columnInfo)Helper method to handle complex type and geospatial type conversion when support is disabled.longgetRowCount()booleanhasNext()Returns if there is next row in the result setstatic booleanisComplexType(ColumnInfoTypeName type)Checks if the given type is a complex type (ARRAY, MAP, STRUCT, GEOMETRY, or GEOGRAPHY).static booleanisGeospatialType(ColumnInfoTypeName type)Checks if the given type is a geospatial type (GEOMETRY or GEOGRAPHY).booleannext()Moves the cursor to next row and returns true if this can be done
-
-
-
Constructor Detail
-
ArrowStreamResult
public ArrowStreamResult(ResultManifest resultManifest, ResultData resultData, StatementId statementId, IDatabricksSession session) throws DatabricksSQLException
- Throws:
DatabricksSQLException
-
ArrowStreamResult
public ArrowStreamResult(TFetchResultsResp resultsResp, IDatabricksStatementInternal parentStatementId, IDatabricksSession session) throws SQLException
- Throws:
SQLException
-
-
Method Detail
-
getArrowMetadata
public List<String> getArrowMetadata() throws DatabricksSQLException
- Throws:
DatabricksSQLException
-
getObject
public Object getObject(int columnIndex) throws DatabricksSQLException
Get the object for given column index. Here index starts with 0.- Specified by:
getObjectin interfaceIExecutionResult- Parameters:
columnIndex- index of column starting with 0- Returns:
- object at given index
- Throws:
DatabricksSQLException- if there is any error in getting object
-
isComplexType
public static boolean isComplexType(ColumnInfoTypeName type)
Checks if the given type is a complex type (ARRAY, MAP, STRUCT, GEOMETRY, or GEOGRAPHY).- Parameters:
type- The type to check- Returns:
- true if the type is a complex type, false otherwise
-
isGeospatialType
public static boolean isGeospatialType(ColumnInfoTypeName type)
Checks if the given type is a geospatial type (GEOMETRY or GEOGRAPHY).- Parameters:
type- The type to check- Returns:
- true if the type is a geospatial type, false otherwise
-
getCurrentRow
public long getCurrentRow()
Gets the current row position, starting with 0.- Specified by:
getCurrentRowin interfaceIExecutionResult- Returns:
- the current row position
-
next
public boolean next() throws DatabricksSQLExceptionMoves the cursor to next row and returns true if this can be done- Specified by:
nextin interfaceIExecutionResult- Returns:
- true if cursor is moved at next row
- Throws:
DatabricksSQLException
-
hasNext
public boolean hasNext()
Returns if there is next row in the result set- Specified by:
hasNextin interfaceIExecutionResult
-
close
public void close()
Closes the result set and releases any in-memory chunks or data- Specified by:
closein interfaceIExecutionResult
-
getRowCount
public long getRowCount()
- Specified by:
getRowCountin interfaceIExecutionResult
-
getChunkCount
public long getChunkCount()
- Specified by:
getChunkCountin interfaceIExecutionResult
-
getChunkProvider
public ChunkProvider getChunkProvider()
Returns the chunk provider for testing purposes.- Returns:
- the chunk provider
-
getObjectWithComplexTypeHandling
protected static Object getObjectWithComplexTypeHandling(IDatabricksSession session, ArrowResultChunkIterator chunkIterator, int columnIndex, ColumnInfoTypeName requiredType, String arrowMetadata, ColumnInfo columnInfo) throws DatabricksSQLException
Helper method to handle complex type and geospatial type conversion when support is disabled.This method is also used by LazyThriftInlineArrowResult for consistent type handling.
- Parameters:
session- The databricks sessionchunkIterator- The chunk iteratorcolumnIndex- The column indexrequiredType- The required column typearrowMetadata- The arrow metadatacolumnInfo- The column info- Returns:
- The object value (converted if complex/geospatial type and support disabled)
- Throws:
DatabricksSQLException- if an error occurs
-
-