Package com.databricks.jdbc.common.util

## Class DatabricksThriftUtil

- java.lang.Object
- - com.databricks.jdbc.common.util.DatabricksThriftUtil

    public class DatabricksThriftUtil
    extends Object

### Field Summary

Fields
`static JdbcLogger` `LOGGER`
`static List<TStatusCode>` `SUCCESS_STATUS_LIST`

### Constructor Summary

Constructors
`DatabricksThriftUtil()`

### Method Summary

All Methods Static Methods Concrete Methods
`static String` `byteBufferToString​(ByteBuffer buffer)`
`static void` `checkDirectResultsForErrorStatus​(TSparkDirectResults directResults, String context)`
`static List<List<Object>>` `convertColumnarToRowBased​(TRowSet rowSet)` Converts columnar data from a TRowSet to a row-based list format.
`static ExternalLink` `createExternalLink​(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 int` `getColumnCount​(TGetResultSetMetadataResp resultManifest)`
`static TNamespace` `getNamespace​(String catalog, String schema)`
`static long` `getRowCount​(TRowSet resultData)`
`static String` `getStatementId​(TOperationHandle operationHandle)`
`static com.databricks.sdk.service.sql.ColumnInfoTypeName` `getTypeFromTypeDesc​(TTypeDesc typeDesc)`
`static void` `verifySuccessStatus​(TStatusCode statusCode, String errorContext)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### LOGGER

    public static final JdbcLogger LOGGER

#### SUCCESS_STATUS_LIST

    public static final List<TStatusCode> SUCCESS_STATUS_LIST

### Constructor Detail

#### DatabricksThriftUtil

    public DatabricksThriftUtil()

### 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`