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)static List<List<Object>>convertColumnarToRowBased(TFetchResultsResp resultsResp, IDatabricksStatementInternal parentStatement, IDatabricksSession session)static ExternalLinkcreateExternalLink(TSparkArrowResultLink chunkInfo, long chunkIndex)static List<List<Object>>extractValues(List<TColumn> columnList)In metadata operations, a list of singleton lists is obtained.static List<List<Object>>extractValuesColumnar(List<TColumn> columnList)static List<List<Object>>extractValuesFromRowSet(TRowSet rowSet)Extracts and returns the values from each column of a TRowSet as a list of lists.static com.databricks.sdk.service.sql.StatementStatusgetAsyncStatus(TStatus status)Returns statement status for given status responsestatic intgetColumnCount(TGetResultSetMetadataResp resultManifest)static TNamespacegetNamespace(String catalog, String schema)static TOperationHandlegetOperationHandle(StatementId statementId)static longgetRowCount(TRowSet resultData)static com.databricks.sdk.service.sql.StatementStatusgetStatementStatus(TGetOperationStatusResp resp)Returns statement status for given operation status responsestatic com.databricks.sdk.service.sql.ColumnInfoTypeNamegetTypeFromTypeDesc(TTypeDesc typeDesc)static voidverifySuccessStatus(TStatus status, String errorContext)
-
-
-
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
-
getColumnCount
public static int getColumnCount(TGetResultSetMetadataResp resultManifest)
-
extractValues
public static List<List<Object>> extractValues(List<TColumn> columnList)
In metadata operations, a list of singleton lists is obtained. This function extracts metadata values from these TColumn lists based on the data type set in the column.- Parameters:
columnList- the TColumn from which to extract values- Returns:
- a singleton list of metadata result
-
extractValuesColumnar
public static List<List<Object>> extractValuesColumnar(List<TColumn> columnList)
-
getStatementStatus
public static com.databricks.sdk.service.sql.StatementStatus getStatementStatus(TGetOperationStatusResp resp)
Returns statement status for given operation status response
-
getAsyncStatus
public static com.databricks.sdk.service.sql.StatementStatus getAsyncStatus(TStatus status)
Returns statement status for given status response
-
getTypeFromTypeDesc
public static com.databricks.sdk.service.sql.ColumnInfoTypeName getTypeFromTypeDesc(TTypeDesc typeDesc)
-
convertColumnarToRowBased
public static List<List<Object>> convertColumnarToRowBased(TFetchResultsResp resultsResp, IDatabricksStatementInternal parentStatement, IDatabricksSession session) throws DatabricksSQLException
- Throws:
DatabricksSQLException
-
getOperationHandle
public static TOperationHandle getOperationHandle(StatementId statementId)
-
extractValuesFromRowSet
public static List<List<Object>> extractValuesFromRowSet(TRowSet rowSet)
Extracts and returns the values from each column of a TRowSet as a list of lists. Each sublist represents a column of values. Returns an empty list if the input is null or contains no columns.- Parameters:
rowSet- the TRowSet to extract values from- Returns:
- a list of lists, each containing the values of a column, or an empty list if the input is invalid
-
getRowCount
public static long getRowCount(TRowSet resultData)
-
checkDirectResultsForErrorStatus
public static void checkDirectResultsForErrorStatus(TSparkDirectResults directResults, String context) throws DatabricksHttpException
- Throws:
DatabricksHttpException
-
-