Package com.databricks.jdbc.common.util
Class DatabricksThriftUtil
- java.lang.Object
-
- com.databricks.jdbc.common.util.DatabricksThriftUtil
-
public class DatabricksThriftUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description DatabricksThriftUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringbyteBufferToString(ByteBuffer buffer)static voidcheckDirectResultsForErrorStatus(TSparkDirectResults directResults, String context, String statementId)static List<List<Object>>convertColumnarToRowBased(TFetchResultsResp resultsResp, IDatabricksStatementInternal parentStatement, IDatabricksSession session)static ColumnarRowViewcreateColumnarView(TRowSet rowSet)Memory-efficient alternative that creates a columnar view instead of materializing all rows.static ExternalLinkcreateExternalLink(TSparkArrowResultLink chunkInfo, long chunkIndex)static List<List<Object>>extractRowsFromColumnar(TRowSet rowSet)This functions extracts columnar data from a RowSet into rowsstatic StatementStatusgetAsyncStatus(TStatus status)Returns statement status for given status responsestatic intgetColumnCount(TGetResultSetMetadataResp resultManifest)static ColumnInfogetColumnInfoFromTColumnDesc(TColumnDesc columnDesc)static TNamespacegetNamespace(String catalog, String schema)static TOperationHandlegetOperationHandle(StatementId statementId)static longgetRowCount(TRowSet resultData)static StatementStatusgetStatementStatus(TGetOperationStatusResp resp)Returns statement status for given operation status responsestatic StringgetTypeTextFromTypeDesc(TTypeDesc typeDesc)static voidverifySuccessStatus(TStatus status, String errorContext)static voidverifySuccessStatus(TStatus status, String errorContext, String statementId)
-
-
-
Method Detail
-
getNamespace
public static TNamespace getNamespace(String catalog, String schema)
-
byteBufferToString
public static String byteBufferToString(ByteBuffer buffer)
-
createExternalLink
public static ExternalLink createExternalLink(TSparkArrowResultLink chunkInfo, long chunkIndex)
-
verifySuccessStatus
public static void verifySuccessStatus(TStatus status, String errorContext) throws DatabricksHttpException
- Throws:
DatabricksHttpException
-
verifySuccessStatus
public static void verifySuccessStatus(TStatus status, String errorContext, String statementId) throws DatabricksHttpException
- Throws:
DatabricksHttpException
-
getColumnCount
public static int getColumnCount(TGetResultSetMetadataResp resultManifest)
-
extractRowsFromColumnar
public static List<List<Object>> extractRowsFromColumnar(TRowSet rowSet) throws DatabricksSQLException
This functions extracts columnar data from a RowSet into rows- Parameters:
rowSet- that contains columnar data- Returns:
- a list of rows
- Throws:
DatabricksSQLException
-
createColumnarView
public static ColumnarRowView createColumnarView(TRowSet rowSet) throws DatabricksSQLException
Memory-efficient alternative that creates a columnar view instead of materializing all rows. Use this method to significantly reduce memory allocations when accessing row data.- Parameters:
rowSet- that contains columnar data- Returns:
- a columnar view that provides row-based access without full materialization
- Throws:
DatabricksSQLException
-
getStatementStatus
public static StatementStatus getStatementStatus(TGetOperationStatusResp resp)
Returns statement status for given operation status response
-
getAsyncStatus
public static StatementStatus getAsyncStatus(TStatus status)
Returns statement status for given status response
-
getColumnInfoFromTColumnDesc
public static ColumnInfo getColumnInfoFromTColumnDesc(TColumnDesc columnDesc)
-
convertColumnarToRowBased
public static List<List<Object>> convertColumnarToRowBased(TFetchResultsResp resultsResp, IDatabricksStatementInternal parentStatement, IDatabricksSession session) throws DatabricksSQLException
- Throws:
DatabricksSQLException
-
getOperationHandle
public static TOperationHandle getOperationHandle(StatementId statementId)
-
getRowCount
public static long getRowCount(TRowSet resultData) throws DatabricksSQLException
- Throws:
DatabricksSQLException
-
checkDirectResultsForErrorStatus
public static void checkDirectResultsForErrorStatus(TSparkDirectResults directResults, String context, String statementId) throws DatabricksHttpException
- Throws:
DatabricksHttpException
-
-