Interface IDatabricksClient

    • Method Detail

      • executeStatement

        DatabricksResultSet executeStatement​(String sql,
                                             IDatabricksComputeResource computeResource,
                                             Map<Integer,​ImmutableSqlParameter> parameters,
                                             StatementType statementType,
                                             IDatabricksSession session,
                                             IDatabricksStatementInternal parentStatement,
                                             MetadataOperationType metadataOperationType)
                                      throws SQLException
        Executes a statement in Databricks server
        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
        metadataOperationType - optional metadata operation type for CP-side logging (e.g., GET_TABLES, GET_COLUMNS). Pass null for non-metadata operations. When provided, adds X-Databricks-Metadata-Operation-Type header to help distinguish metadata operations from regular SQL queries in logs.
        Returns:
        response for statement execution
        Throws:
        SQLException
      • checkStatementAlive

        default boolean checkStatementAlive​(StatementId statementId)
                                     throws SQLException
        Checks the status of a statement without fetching results. Used for heartbeat polling to keep server-side operation state alive during slow result consumption.
        Parameters:
        statementId - statement to check status for
        Returns:
        true if the statement is still in a non-terminal state (alive), false if terminal
        Throws:
        SQLException
      • getResultChunks

        ChunkLinkFetchResult getResultChunks​(StatementId statementId,
                                             long chunkIndex,
                                             long chunkStartRowOffset)
                                      throws SQLException
        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
        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

        ResultData getResultChunksData​(StatementId statementId,
                                       long chunkIndex)
                                throws DatabricksSQLException
        Fetches the result data for given chunk index and statement-Id.
        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
      • resetAccessToken

        void resetAccessToken​(String newAccessToken)
        Update the access token based on new value provided by the customer
        Parameters:
        newAccessToken - new access token value
      • getDatabricksConfig

        com.databricks.sdk.core.DatabricksConfig getDatabricksConfig()
        Retrieves underlying DatabricksConfig