Class DatabricksThriftHelper
- java.lang.Object
-
- com.databricks.jdbc.client.impl.thrift.commons.DatabricksThriftHelper
-
public class DatabricksThriftHelper extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static List<TStatusCode>SUCCESS_STATUS_LIST
-
Constructor Summary
Constructors Constructor Description DatabricksThriftHelper()
-
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(TRowSet rowSet)Converts columnar data from a TRowSet to a row-based list format.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 intgetColumnCount(TGetResultSetMetadataResp resultManifest)static TNamespacegetNamespace(String catalog, String schema)static longgetRowCount(TRowSet resultData)static StringgetStatementId(TOperationHandle operationHandle)static com.databricks.sdk.service.sql.ColumnInfoTypeNamegetTypeFromTypeDesc(TTypeDesc typeDesc)static voidverifySuccessStatus(TStatusCode statusCode, String errorContext)
-
-
-
Field Detail
-
SUCCESS_STATUS_LIST
public static final List<TStatusCode> SUCCESS_STATUS_LIST
-
-
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)
-
getStatementId
public static String getStatementId(TOperationHandle operationHandle)
-
verifySuccessStatus
public static void verifySuccessStatus(TStatusCode statusCode, 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)
-
getTypeFromTypeDesc
public static com.databricks.sdk.service.sql.ColumnInfoTypeName getTypeFromTypeDesc(TTypeDesc typeDesc)
-
convertColumnarToRowBased
public static List<List<Object>> convertColumnarToRowBased(TRowSet rowSet)
Converts columnar data from a TRowSet to a row-based list format.- Parameters:
rowSet- the TRowSet containing the data- Returns:
- a list where each sublist represents a row with column values, or an empty list if rowSet is empty
-
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
-
-