Package com.databricks.jdbc.dbclient.impl.thrift

## Class DatabricksThriftServiceClient

- java.lang.Object
- - com.databricks.jdbc.dbclient.impl.thrift.DatabricksThriftServiceClient

All Implemented Interfaces:
  `IDatabricksClient`, `IDatabricksMetadataClient`

    public class DatabricksThriftServiceClient
    extends Object
    implements IDatabricksClient, IDatabricksMetadataClient

### Constructor Summary

Constructors
`DatabricksThriftServiceClient​(IDatabricksConnectionContext connectionContext)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `cancelStatement​(StatementId statementId)` Cancels a statement in Databricks server
`void` `closeStatement​(StatementId statementId)` Closes a statement in Databricks server
`ImmutableSessionInfo` `createSession​(IDatabricksComputeResource cluster, String catalog, String schema, Map<String,​String> sessionConf)` Creates a new session for given warehouse-Id, catalog and session.
`void` `deleteSession​(ImmutableSessionInfo sessionInfo)` Deletes a session for given session-Id
`DatabricksResultSet` `executeStatement​(String sql, IDatabricksComputeResource computeResource, Map<Integer,​ImmutableSqlParameter> parameters, StatementType statementType, IDatabricksSession session, IDatabricksStatementInternal parentStatement)` Executes a statement in Databricks server
`DatabricksResultSet` `executeStatementAsync​(String sql, IDatabricksComputeResource computeResource, Map<Integer,​ImmutableSqlParameter> parameters, IDatabricksSession session, IDatabricksStatementInternal parentStatement)` Executes a statement in Databricks server asynchronously
`IDatabricksConnectionContext` `getConnectionContext()`
`com.databricks.sdk.core.DatabricksConfig` `getDatabricksConfig()` Retrieves underlying DatabricksConfig
`TFetchResultsResp` `getMoreResults​(IDatabricksStatementInternal parentStatement)`
`ChunkLinkFetchResult` `getResultChunks​(StatementId statementId, long chunkIndex, long chunkStartRowOffset)` Fetches the chunk links for given chunk index and statement-Id.
`ResultData` `getResultChunksData​(StatementId statementId, long chunkIndex)` Fetches the result data for given chunk index and statement-Id.
`DatabricksResultSet` `getStatementResult​(StatementId statementId, IDatabricksSession session, IDatabricksStatementInternal parentStatement)` Fetches result for underlying statement-Id
`DatabricksResultSet` `listCatalogs​(IDatabricksSession session)` Returns the list of catalogs
`DatabricksResultSet` `listColumns​(IDatabricksSession session, String catalog, String schemaNamePattern, String tableNamePattern, String columnNamePattern)` Returns the list of columns
`DatabricksResultSet` `listCrossReferences​(IDatabricksSession session, String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable)` Returns the list of cross references between a parent table and a foreign table
`DatabricksResultSet` `listExportedKeys​(IDatabricksSession session, String catalog, String schema, String table)` Returns the list of imported keys
`DatabricksResultSet` `listFunctions​(IDatabricksSession session, String catalog, String schemaNamePattern, String functionNamePattern)` Returns the list of functions
`DatabricksResultSet` `listImportedKeys​(IDatabricksSession session, String catalog, String schema, String table)` Returns the list of imported keys
`DatabricksResultSet` `listPrimaryKeys​(IDatabricksSession session, String catalog, String schema, String table)` Returns the list of primary keys
`DatabricksResultSet` `listSchemas​(IDatabricksSession session, String catalog, String schemaNamePattern)` Returns the list of schemas
`DatabricksResultSet` `listTables​(IDatabricksSession session, String catalog, String schemaNamePattern, String tableNamePattern, String[] tableTypes)` Returns the list of tables
`DatabricksResultSet` `listTableTypes​(IDatabricksSession session)` Returns list of table types
`DatabricksResultSet` `listTypeInfo​(IDatabricksSession session)` Returns information about types supported by Databricks server
`void` `resetAccessToken​(String newAccessToken)` Update the access token based on new value provided by the customer

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

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

### Constructor Detail

#### DatabricksThriftServiceClient

    public DatabricksThriftServiceClient​(IDatabricksConnectionContext connectionContext)
                                  throws DatabricksParsingException,
                                         DatabricksValidationException

Throws:
  `DatabricksParsingException`
  `DatabricksValidationException`

### Method Detail

#### getConnectionContext

    public IDatabricksConnectionContext getConnectionContext()

Specified by:
  `getConnectionContext` in interface `IDatabricksClient`

#### resetAccessToken

    public void resetAccessToken​(String newAccessToken)

Description copied from interface: `IDatabricksClient`
Update the access token based on new value provided by the customer

Specified by:
  `resetAccessToken` in interface `IDatabricksClient`
Parameters:
  `newAccessToken` - new access token value

#### createSession

    public ImmutableSessionInfo createSession​(IDatabricksComputeResource cluster,
                                              String catalog,
                                              String schema,
                                              Map<String,​String> sessionConf)
                                       throws SQLException

Description copied from interface: `IDatabricksClient`
Creates a new session for given warehouse-Id, catalog and session.

Specified by:
  `createSession` in interface `IDatabricksClient`
Parameters:
  `cluster` - underlying SQL-warehouse or all-purpose cluster
  `catalog` - for the session
  `schema` - for the session
  `sessionConf` - session configuration
Returns:
  created session
Throws:
  `SQLException`

#### deleteSession

    public void deleteSession​(ImmutableSessionInfo sessionInfo)
                       throws SQLException

Description copied from interface: `IDatabricksClient`
Deletes a session for given session-Id

Specified by:
  `deleteSession` in interface `IDatabricksClient`
Parameters:
  `sessionInfo` - for which the session should be deleted
Throws:
  `SQLException`

#### executeStatement

    public DatabricksResultSet executeStatement​(String sql,
                                                IDatabricksComputeResource computeResource,
                                                Map<Integer,​ImmutableSqlParameter> parameters,
                                                StatementType statementType,
                                                IDatabricksSession session,
                                                IDatabricksStatementInternal parentStatement)
                                         throws SQLException

Description copied from interface: `IDatabricksClient`
Executes a statement in Databricks server

Specified by:
  `executeStatement` in interface `IDatabricksClient`
Parameters:
  `sql` - SQL statement that needs to be executed
  `computeResource` - underlying SQL-warehouse or all-purpose cluster
  `parameters` - SQL parameters for the statement
  `statementType` - type of statement (metadata, update or generic SQL)
  `session` - underlying session
  `parentStatement` - statement instance if called from a statement
Returns:
  response for statement execution
Throws:
  `SQLException`

#### executeStatementAsync

    public DatabricksResultSet executeStatementAsync​(String sql,
                                                     IDatabricksComputeResource computeResource,
                                                     Map<Integer,​ImmutableSqlParameter> parameters,
                                                     IDatabricksSession session,
                                                     IDatabricksStatementInternal parentStatement)
                                              throws SQLException

Description copied from interface: `IDatabricksClient`
Executes a statement in Databricks server asynchronously

Specified by:
  `executeStatementAsync` in interface `IDatabricksClient`
Parameters:
  `sql` - SQL statement that needs to be executed
  `computeResource` - underlying SQL-warehouse or all-purpose cluster
  `parameters` - SQL parameters for the statement
  `session` - underlying session
  `parentStatement` - statement instance if called from a statement
Returns:
  response for statement execution
Throws:
  `SQLException`

#### closeStatement

    public void closeStatement​(StatementId statementId)
                        throws DatabricksSQLException

Description copied from interface: `IDatabricksClient`
Closes a statement in Databricks server

Specified by:
  `closeStatement` in interface `IDatabricksClient`
Parameters:
  `statementId` - statement which should be closed
Throws:
  `DatabricksSQLException`

#### cancelStatement

    public void cancelStatement​(StatementId statementId)
                         throws DatabricksSQLException

Description copied from interface: `IDatabricksClient`
Cancels a statement in Databricks server

Specified by:
  `cancelStatement` in interface `IDatabricksClient`
Parameters:
  `statementId` - statement which should be aborted
Throws:
  `DatabricksSQLException`

#### getStatementResult

    public DatabricksResultSet getStatementResult​(StatementId statementId,
                                                  IDatabricksSession session,
                                                  IDatabricksStatementInternal parentStatement)
                                           throws SQLException

Description copied from interface: `IDatabricksClient`
Fetches result for underlying statement-Id

Specified by:
  `getStatementResult` in interface `IDatabricksClient`
Parameters:
  `statementId` - statement which should be checked for status
  `session` - underlying session
  `parentStatement` - statement instance
Throws:
  `SQLException`

#### getResultChunks

    public ChunkLinkFetchResult getResultChunks​(StatementId statementId,
                                                long chunkIndex,
                                                long chunkStartRowOffset)
                                         throws SQLException

Description copied from interface: `IDatabricksClient`
Fetches the chunk links for given chunk index and statement-Id.

For SEA clients, the chunkIndex is used to identify which chunk to fetch. For Thrift clients, the rowOffset is used with FETCH_ABSOLUTE orientation to seek to the correct position.

The returned `ChunkLinkFetchResult` contains the chunk links and continuation information:

- SEA: hasMore derived from last link's nextChunkIndex
- Thrift: hasMore from server's hasMoreRows flag, nextRowOffset for continuation

Specified by:
  `getResultChunks` in interface `IDatabricksClient`
Parameters:
  `statementId` - statement-Id for which chunk should be fetched
  `chunkIndex` - chunkIndex for which chunk should be fetched
  `chunkStartRowOffset` - the row offset where the chunk starts in the result set
Throws:
  `SQLException`

#### getResultChunksData

    public ResultData getResultChunksData​(StatementId statementId,
                                          long chunkIndex)
                                   throws DatabricksSQLException

Description copied from interface: `IDatabricksClient`
Fetches the result data for given chunk index and statement-Id.

Specified by:
  `getResultChunksData` in interface `IDatabricksClient`
Parameters:
  `statementId` - statement-Id for which chunk data should be fetched
  `chunkIndex` - chunkIndex for which chunk data should be fetched
Returns:
  ResultData containing the chunk's data array and metadata
Throws:
  `DatabricksSQLException`

#### listTypeInfo

    public DatabricksResultSet listTypeInfo​(IDatabricksSession session)

Description copied from interface: `IDatabricksMetadataClient`
Returns information about types supported by Databricks server

Specified by:
  `listTypeInfo` in interface `IDatabricksMetadataClient`

#### listCatalogs

    public DatabricksResultSet listCatalogs​(IDatabricksSession session)
                                     throws SQLException

Description copied from interface: `IDatabricksMetadataClient`
Returns the list of catalogs

Specified by:
  `listCatalogs` in interface `IDatabricksMetadataClient`
Throws:
  `SQLException`

#### listSchemas

    public DatabricksResultSet listSchemas​(IDatabricksSession session,
                                           String catalog,
                                           String schemaNamePattern)
                                    throws SQLException

Description copied from interface: `IDatabricksMetadataClient`
Returns the list of schemas

Specified by:
  `listSchemas` in interface `IDatabricksMetadataClient`
Parameters:
  `session` - underlying session
  `catalog` - catalogName which must match to catalog in database
  `schemaNamePattern` - must match to schema name in database (can be a regex pattern or absolute name)
Returns:
  a DatabricksResultSet representing list of schemas
Throws:
  `SQLException`

#### listTables

    public DatabricksResultSet listTables​(IDatabricksSession session,
                                          String catalog,
                                          String schemaNamePattern,
                                          String tableNamePattern,
                                          String[] tableTypes)
                                   throws SQLException

Description copied from interface: `IDatabricksMetadataClient`
Returns the list of tables

Specified by:
  `listTables` in interface `IDatabricksMetadataClient`
Parameters:
  `session` - underlying session
  `catalog` - catalogName which must match to catalog in database
  `schemaNamePattern` - must match to schema name in database (can be a regex pattern or absolute name)
  `tableNamePattern` - must match to table name in database (can be a regex pattern or absolute name)
Returns:
  a DatabricksResultSet representing list of tables
Throws:
  `SQLException`

#### listTableTypes

    public DatabricksResultSet listTableTypes​(IDatabricksSession session)

Description copied from interface: `IDatabricksMetadataClient`
Returns list of table types

Specified by:
  `listTableTypes` in interface `IDatabricksMetadataClient`

#### listColumns

    public DatabricksResultSet listColumns​(IDatabricksSession session,
                                           String catalog,
                                           String schemaNamePattern,
                                           String tableNamePattern,
                                           String columnNamePattern)
                                    throws SQLException

Description copied from interface: `IDatabricksMetadataClient`
Returns the list of columns

Specified by:
  `listColumns` in interface `IDatabricksMetadataClient`
Parameters:
  `session` - underlying session
  `catalog` - catalogName which must match to catalog in database
  `schemaNamePattern` - must match to schema name in database (can be a regex pattern or absolute name)
  `tableNamePattern` - must match to table name in database (can be a regex pattern or absolute name)
  `columnNamePattern` - must match to column name in database (can be a regex pattern or absolute name)
Returns:
  a DatabricksResultSet representing list of columns
Throws:
  `SQLException`

#### listFunctions

    public DatabricksResultSet listFunctions​(IDatabricksSession session,
                                             String catalog,
                                             String schemaNamePattern,
                                             String functionNamePattern)
                                      throws SQLException

Description copied from interface: `IDatabricksMetadataClient`
Returns the list of functions

Specified by:
  `listFunctions` in interface `IDatabricksMetadataClient`
Parameters:
  `session` - underlying session
  `catalog` - catalogName which must match to catalog in database
  `schemaNamePattern` - must match to schema name in database (can be a regex pattern or absolute name)
  `functionNamePattern` - must match to function name in database (can be a regex pattern or absolute name)
Returns:
  a DatabricksResultSet representing list of functions
Throws:
  `SQLException`

#### listPrimaryKeys

    public DatabricksResultSet listPrimaryKeys​(IDatabricksSession session,
                                               String catalog,
                                               String schema,
                                               String table)
                                        throws SQLException

Description copied from interface: `IDatabricksMetadataClient`
Returns the list of primary keys

Specified by:
  `listPrimaryKeys` in interface `IDatabricksMetadataClient`
Parameters:
  `session` - underlying session
  `catalog` - catalogName which must match to catalog in database
  `schema` - must match to a schema in database
  `table` - must match to a table in database
Returns:
  a DatabricksResultSet representing list of functions
Throws:
  `SQLException`

#### listImportedKeys

    public DatabricksResultSet listImportedKeys​(IDatabricksSession session,
                                                String catalog,
                                                String schema,
                                                String table)
                                         throws SQLException

Description copied from interface: `IDatabricksMetadataClient`
Returns the list of imported keys

Specified by:
  `listImportedKeys` in interface `IDatabricksMetadataClient`
Parameters:
  `session` - underlying session
  `catalog` - catalogName which must match to catalog in database
  `schema` - must match to a schema in database
  `table` - must match to a table in database
Returns:
  a DatabricksResultSet representing list of imported keys
Throws:
  `SQLException`

#### listExportedKeys

    public DatabricksResultSet listExportedKeys​(IDatabricksSession session,
                                                String catalog,
                                                String schema,
                                                String table)
                                         throws SQLException

Description copied from interface: `IDatabricksMetadataClient`
Returns the list of imported keys

Specified by:
  `listExportedKeys` in interface `IDatabricksMetadataClient`
Parameters:
  `session` - underlying session
  `catalog` - catalogName which must match to catalog in database
  `schema` - must match to a schema in database
  `table` - must match to a table in database
Returns:
  a DatabricksResultSet representing list of imported keys
Throws:
  `SQLException`

#### listCrossReferences

    public DatabricksResultSet listCrossReferences​(IDatabricksSession session,
                                                   String parentCatalog,
                                                   String parentSchema,
                                                   String parentTable,
                                                   String foreignCatalog,
                                                   String foreignSchema,
                                                   String foreignTable)
                                            throws SQLException

Description copied from interface: `IDatabricksMetadataClient`
Returns the list of cross references between a parent table and a foreign table

Specified by:
  `listCrossReferences` in interface `IDatabricksMetadataClient`
Parameters:
  `session` - underlying session
  `parentCatalog` - catalogName which must match to catalog in database
  `parentSchema` - must match to a schema in database
  `parentTable` - must match to a table in database
  `foreignCatalog` - catalogName which must match to foreign catalog in database
  `foreignSchema` - must match to a foreign schema in database
  `foreignTable` - must match to a foreign table in database
Returns:
  a DatabricksResultSet representing list of cross references
Throws:
  `SQLException`

#### getMoreResults

    public TFetchResultsResp getMoreResults​(IDatabricksStatementInternal parentStatement)
                                     throws SQLException

Specified by:
  `getMoreResults` in interface `IDatabricksClient`
Throws:
  `SQLException`

#### getDatabricksConfig

    public com.databricks.sdk.core.DatabricksConfig getDatabricksConfig()

Description copied from interface: `IDatabricksClient`
Retrieves underlying DatabricksConfig

Specified by:
  `getDatabricksConfig` in interface `IDatabricksClient`