Interface BrokerClient

All Known Implementing Classes:
BrokerClientImpl

public interface BrokerClient
High-level Broker client.

All methods return futures, enabling asynchronous logic. If you want a synchronous response, use FutureUtils.get or FutureUtils.getUnchecked. Futures resolve to exceptions in the manner described by ServiceClient.asyncRequest(org.apache.druid.rpc.RequestBuilder, org.apache.druid.java.util.http.client.response.HttpResponseHandler<IntermediateType, FinalType>).

Typically acquired via Guice, where it is registered using ServiceClientModule.
  • Method Details

    • submitNativeQuery

      com.google.common.util.concurrent.ListenableFuture<String> submitNativeQuery(Query<?> query)
      Submits the given query to the /druid/v2 endpoint of a Broker.
    • submitSqlQuery

      com.google.common.util.concurrent.ListenableFuture<String> submitSqlQuery(ClientSqlQuery sqlQuery)
      Submit the given sqlQuery to the Broker's SQL query endpoint, /druid/v2/sql/.
    • submitSqlTask

      com.google.common.util.concurrent.ListenableFuture<SqlTaskStatus> submitSqlTask(ClientSqlQuery sqlQuery)
      Submit the given sqlQuery to the Broker's SQL task endpoint, /druid/v2/sql/task/.
    • fetchExplainPlan

      com.google.common.util.concurrent.ListenableFuture<List<ExplainPlan>> fetchExplainPlan(ClientSqlQuery sqlQuery)
      Fetches the explain plan for the given sqlQuery from the Broker's SQL task endpoint.
      Parameters:
      sqlQuery - the SQL query for which the EXPLAIN PLAN FOR information is to be fetched
    • updateCoordinatorDynamicConfig

      com.google.common.util.concurrent.ListenableFuture<Boolean> updateCoordinatorDynamicConfig(CoordinatorDynamicConfig config)
      Updates the broker with the given CoordinatorDynamicConfig.
    • updateBrokerDynamicConfig

      com.google.common.util.concurrent.ListenableFuture<Boolean> updateBrokerDynamicConfig(BrokerDynamicConfig config)
      Updates the broker with the given BrokerDynamicConfig.
    • getQueryReport

      com.google.common.util.concurrent.ListenableFuture<String> getQueryReport(String sqlQueryId, boolean selfOnly)
      Gets the report for a SQL query by its SQL query ID.
      Parameters:
      sqlQueryId - the SQL query ID
      selfOnly - if true, only check the local broker; if false, check all brokers
      Returns:
      JSON response from the report API
    • cancelSqlQuery

      com.google.common.util.concurrent.ListenableFuture<Boolean> cancelSqlQuery(String sqlQueryId)
      Cancels a SQL query by its SQL query ID.
      Parameters:
      sqlQueryId - the SQL query ID to cancel
      Returns:
      true if the cancellation was accepted