Class DatabricksThriftServiceClient
- java.lang.Object
-
- com.databricks.jdbc.client.impl.thrift.DatabricksThriftServiceClient
-
- All Implemented Interfaces:
DatabricksClient,DatabricksMetadataClient
public class DatabricksThriftServiceClient extends Object implements DatabricksClient, DatabricksMetadataClient
-
-
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(ComputeResource cluster, String catalog, String schema, Map<String,String> sessionConf)Creates a new session for given warehouse-Id, catalog and session.voiddeleteSession(IDatabricksSession session, ComputeResource cluster)Deletes a session for given session-IdDatabricksResultSetexecuteStatement(String sql, ComputeResource computeResource, Map<Integer,ImmutableSqlParameter> parameters, StatementType statementType, IDatabricksSession session, IDatabricksStatement parentStatement)Executes a statement in Databricks serverCollection<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 server
-
-
-
Constructor Detail
-
DatabricksThriftServiceClient
public DatabricksThriftServiceClient(IDatabricksConnectionContext connectionContext) throws DatabricksParsingException
- Throws:
DatabricksParsingException
-
-
Method Detail
-
createSession
public ImmutableSessionInfo createSession(ComputeResource cluster, String catalog, String schema, Map<String,String> sessionConf) throws DatabricksSQLException
Description copied from interface:DatabricksClientCreates a new session for given warehouse-Id, catalog and session.- Specified by:
createSessionin interfaceDatabricksClient- 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, ComputeResource cluster) throws DatabricksSQLException
Description copied from interface:DatabricksClientDeletes a session for given session-Id- Specified by:
deleteSessionin interfaceDatabricksClient- Parameters:
session- for which the session should be deletedcluster- underlying SQL-warehouse or all-purpose cluster- Throws:
DatabricksSQLException
-
executeStatement
public DatabricksResultSet executeStatement(String sql, ComputeResource computeResource, Map<Integer,ImmutableSqlParameter> parameters, StatementType statementType, IDatabricksSession session, IDatabricksStatement parentStatement) throws SQLException
Description copied from interface:DatabricksClientExecutes a statement in Databricks server- Specified by:
executeStatementin interfaceDatabricksClient- 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:DatabricksClientCloses a statement in Databricks server- Specified by:
closeStatementin interfaceDatabricksClient- Parameters:
statementId- statement which should be closed- Throws:
DatabricksSQLException
-
cancelStatement
public void cancelStatement(String statementId) throws DatabricksSQLException
Description copied from interface:DatabricksClientCancels a statement in Databricks server- Specified by:
cancelStatementin interfaceDatabricksClient- Parameters:
statementId- statement which should be aborted- Throws:
DatabricksSQLException
-
getResultChunks
public Collection<ExternalLink> getResultChunks(String statementId, long chunkIndex) throws DatabricksSQLException
Description copied from interface:DatabricksClientFetches the chunk details for given chunk index and statement-Id.- Specified by:
getResultChunksin interfaceDatabricksClient- 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:DatabricksMetadataClientReturns information about types supported by Databricks server- Specified by:
listTypeInfoin interfaceDatabricksMetadataClient- Throws:
DatabricksSQLException
-
listCatalogs
public DatabricksResultSet listCatalogs(IDatabricksSession session) throws SQLException
Description copied from interface:DatabricksMetadataClientReturns the list of catalogs- Specified by:
listCatalogsin interfaceDatabricksMetadataClient- Throws:
SQLException
-
listSchemas
public DatabricksResultSet listSchemas(IDatabricksSession session, String catalog, String schemaNamePattern) throws SQLException
Description copied from interface:DatabricksMetadataClientReturns the list of schemas- Specified by:
listSchemasin interfaceDatabricksMetadataClient- 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:DatabricksMetadataClientReturns the list of tables- Specified by:
listTablesin interfaceDatabricksMetadataClient- 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:DatabricksMetadataClientReturns list of table types- Specified by:
listTableTypesin interfaceDatabricksMetadataClient
-
listColumns
public DatabricksResultSet listColumns(IDatabricksSession session, String catalog, String schemaNamePattern, String tableNamePattern, String columnNamePattern) throws DatabricksSQLException
Description copied from interface:DatabricksMetadataClientReturns the list of columns- Specified by:
listColumnsin interfaceDatabricksMetadataClient- 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:DatabricksMetadataClientReturns the list of functions- Specified by:
listFunctionsin interfaceDatabricksMetadataClient- 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:DatabricksMetadataClientReturns the list of primary keys- Specified by:
listPrimaryKeysin interfaceDatabricksMetadataClient- 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
-
-