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
-
-
Field Summary
Fields Modifier and Type Field Description static JdbcLoggerLOGGER
-
Constructor Summary
Constructors Constructor Description DatabricksThriftServiceClient(IDatabricksConnectionContext connectionContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancelStatement(String statementId)Cancels a statement in Databricks servervoidcloseStatement(String statementId)Closes a statement in Databricks serverImmutableSessionInfocreateSession(IDatabricksComputeResource cluster, String catalog, String schema, Map<String,String> sessionConf)Creates a new session for given warehouse-Id, catalog and session.voiddeleteSession(IDatabricksSession session, IDatabricksComputeResource cluster)Deletes a session for given session-IdDatabricksResultSetexecuteStatement(String sql, IDatabricksComputeResource computeResource, Map<Integer,ImmutableSqlParameter> parameters, StatementType statementType, IDatabricksSession session, IDatabricksStatement parentStatement)Executes a statement in Databricks serverIDatabricksConnectionContextgetConnectionContext()Collection<ExternalLink>getResultChunks(String statementId, long chunkIndex)Fetches the chunk details for given chunk index and statement-Id.DatabricksResultSetlistCatalogs(IDatabricksSession session)Returns the list of catalogsDatabricksResultSetlistColumns(IDatabricksSession session, String catalog, String schemaNamePattern, String tableNamePattern, String columnNamePattern)Returns the list of columnsDatabricksResultSetlistFunctions(IDatabricksSession session, String catalog, String schemaNamePattern, String functionNamePattern)Returns the list of functionsDatabricksResultSetlistPrimaryKeys(IDatabricksSession session, String catalog, String schema, String table)Returns the list of primary keysDatabricksResultSetlistSchemas(IDatabricksSession session, String catalog, String schemaNamePattern)Returns the list of schemasDatabricksResultSetlistTables(IDatabricksSession session, String catalog, String schemaNamePattern, String tableNamePattern, String[] tableTypes)Returns the list of tablesDatabricksResultSetlistTableTypes(IDatabricksSession session)Returns list of table typesDatabricksResultSetlistTypeInfo(IDatabricksSession session)Returns information about types supported by Databricks servervoidresetAccessToken(String newAccessToken)Update the access token based on new value provided by the customer
-
-
-
Field Detail
-
LOGGER
public static final JdbcLogger LOGGER
-
-
Constructor Detail
-
DatabricksThriftServiceClient
public DatabricksThriftServiceClient(IDatabricksConnectionContext connectionContext) throws DatabricksParsingException
- Throws:
DatabricksParsingException
-
-
Method Detail
-
getConnectionContext
public IDatabricksConnectionContext getConnectionContext()
- Specified by:
getConnectionContextin interfaceIDatabricksClient
-
resetAccessToken
public void resetAccessToken(String newAccessToken)
Description copied from interface:IDatabricksClientUpdate the access token based on new value provided by the customer- Specified by:
resetAccessTokenin interfaceIDatabricksClient- Parameters:
newAccessToken- new access token value
-
createSession
public ImmutableSessionInfo createSession(IDatabricksComputeResource cluster, String catalog, String schema, Map<String,String> sessionConf) throws DatabricksSQLException
Description copied from interface:IDatabricksClientCreates a new session for given warehouse-Id, catalog and session.- Specified by:
createSessionin interfaceIDatabricksClient- Parameters:
cluster- underlying SQL-warehouse or all-purpose clustercatalog- for the sessionschema- for the sessionsessionConf- session configuration- Returns:
- created session
- Throws:
DatabricksSQLException
-
deleteSession
public void deleteSession(IDatabricksSession session, IDatabricksComputeResource cluster) throws DatabricksSQLException
Description copied from interface:IDatabricksClientDeletes a session for given session-Id- Specified by:
deleteSessionin interfaceIDatabricksClient- Parameters:
session- for which the session should be deletedcluster- underlying SQL-warehouse or all-purpose cluster- Throws:
DatabricksSQLException
-
executeStatement
public DatabricksResultSet executeStatement(String sql, IDatabricksComputeResource computeResource, Map<Integer,ImmutableSqlParameter> parameters, StatementType statementType, IDatabricksSession session, IDatabricksStatement parentStatement) throws SQLException
Description copied from interface:IDatabricksClientExecutes a statement in Databricks server- Specified by:
executeStatementin interfaceIDatabricksClient- Parameters:
sql- SQL statement that needs to be executedcomputeResource- underlying SQL-warehouse or all-purpose clusterparameters- SQL parameters for the statementstatementType- type of statement (metadata, update or generic SQL)session- underlying sessionparentStatement- statement instance if called from a statement- Returns:
- response for statement execution
- Throws:
SQLException
-
closeStatement
public void closeStatement(String statementId) throws DatabricksSQLException
Description copied from interface:IDatabricksClientCloses a statement in Databricks server- Specified by:
closeStatementin interfaceIDatabricksClient- Parameters:
statementId- statement which should be closed- Throws:
DatabricksSQLException
-
cancelStatement
public void cancelStatement(String statementId) throws DatabricksSQLException
Description copied from interface:IDatabricksClientCancels a statement in Databricks server- Specified by:
cancelStatementin interfaceIDatabricksClient- Parameters:
statementId- statement which should be aborted- Throws:
DatabricksSQLException
-
getResultChunks
public Collection<ExternalLink> getResultChunks(String statementId, long chunkIndex) throws DatabricksSQLException
Description copied from interface:IDatabricksClientFetches the chunk details for given chunk index and statement-Id.- Specified by:
getResultChunksin interfaceIDatabricksClient- Parameters:
statementId- statement-Id for which chunk should be fetchedchunkIndex- chunkIndex for which chunk should be fetched- Throws:
DatabricksSQLException
-
listTypeInfo
public DatabricksResultSet listTypeInfo(IDatabricksSession session) throws DatabricksSQLException
Description copied from interface:IDatabricksMetadataClientReturns information about types supported by Databricks server- Specified by:
listTypeInfoin interfaceIDatabricksMetadataClient- Throws:
DatabricksSQLException
-
listCatalogs
public DatabricksResultSet listCatalogs(IDatabricksSession session) throws SQLException
Description copied from interface:IDatabricksMetadataClientReturns the list of catalogs- Specified by:
listCatalogsin interfaceIDatabricksMetadataClient- Throws:
SQLException
-
listSchemas
public DatabricksResultSet listSchemas(IDatabricksSession session, String catalog, String schemaNamePattern) throws SQLException
Description copied from interface:IDatabricksMetadataClientReturns the list of schemas- Specified by:
listSchemasin interfaceIDatabricksMetadataClient- Parameters:
session- underlying sessioncatalog- catalogName which must match to catalog in databaseschemaNamePattern- 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:IDatabricksMetadataClientReturns the list of tables- Specified by:
listTablesin interfaceIDatabricksMetadataClient- Parameters:
session- underlying sessioncatalog- catalogName which must match to catalog in databaseschemaNamePattern- 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:IDatabricksMetadataClientReturns list of table types- Specified by:
listTableTypesin interfaceIDatabricksMetadataClient
-
listColumns
public DatabricksResultSet listColumns(IDatabricksSession session, String catalog, String schemaNamePattern, String tableNamePattern, String columnNamePattern) throws DatabricksSQLException
Description copied from interface:IDatabricksMetadataClientReturns the list of columns- Specified by:
listColumnsin interfaceIDatabricksMetadataClient- Parameters:
session- underlying sessioncatalog- catalogName which must match to catalog in databaseschemaNamePattern- 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:
DatabricksSQLException
-
listFunctions
public DatabricksResultSet listFunctions(IDatabricksSession session, String catalog, String schemaNamePattern, String functionNamePattern) throws DatabricksSQLException
Description copied from interface:IDatabricksMetadataClientReturns the list of functions- Specified by:
listFunctionsin interfaceIDatabricksMetadataClient- Parameters:
session- underlying sessioncatalog- catalogName which must match to catalog in databaseschemaNamePattern- 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:
DatabricksSQLException
-
listPrimaryKeys
public DatabricksResultSet listPrimaryKeys(IDatabricksSession session, String catalog, String schema, String table) throws SQLException
Description copied from interface:IDatabricksMetadataClientReturns the list of primary keys- Specified by:
listPrimaryKeysin interfaceIDatabricksMetadataClient- Parameters:
session- underlying sessioncatalog- catalogName which must match to catalog in databaseschema- must match to a schema in databasetable- must match to a table in database- Returns:
- a DatabricksResultSet representing list of functions
- Throws:
SQLException
-
-