Search in sources :

Example 1 with BrokerReduceService

use of com.linkedin.pinot.core.query.reduce.BrokerReduceService in project pinot by linkedin.

the class BaseQueriesTest method getBrokerResponseForQuery.

/**
   * Run query on multiple index segments.
   * <p>Use this to test the whole flow from server to broker.
   * <p>The result should be equivalent to querying 4 identical index segments.
   *
   * @param query PQL query.
   * @return broker response.
   */
protected BrokerResponseNative getBrokerResponseForQuery(String query) {
    BrokerRequest brokerRequest = COMPILER.compileToBrokerRequest(query);
    // Server side.
    Plan plan = PLAN_MAKER.makeInterSegmentPlan(getSegmentDataManagers(), brokerRequest, EXECUTOR_SERVICE, 10_000);
    plan.execute();
    DataTable instanceResponse = plan.getInstanceResponse();
    // Broker side.
    BrokerReduceService brokerReduceService = new BrokerReduceService();
    Map<ServerInstance, DataTable> dataTableMap = new HashMap<>();
    dataTableMap.put(new ServerInstance("localhost:0000"), instanceResponse);
    dataTableMap.put(new ServerInstance("localhost:1111"), instanceResponse);
    return brokerReduceService.reduceOnDataTable(brokerRequest, dataTableMap);
}
Also used : BrokerReduceService(com.linkedin.pinot.core.query.reduce.BrokerReduceService) DataTable(com.linkedin.pinot.common.utils.DataTable) HashMap(java.util.HashMap) BrokerRequest(com.linkedin.pinot.common.request.BrokerRequest) Plan(com.linkedin.pinot.core.plan.Plan) ServerInstance(com.linkedin.pinot.common.response.ServerInstance)

Example 2 with BrokerReduceService

use of com.linkedin.pinot.core.query.reduce.BrokerReduceService in project pinot by linkedin.

the class BrokerServerBuilder method buildReduceServiceRegistry.

/**
   * Build the reduce service registry for each broker response.
   */
private ReduceServiceRegistry buildReduceServiceRegistry() {
    ReduceServiceRegistry reduceServiceRegistry = new ReduceServiceRegistry();
    BrokerReduceService reduceService = new BrokerReduceService();
    reduceServiceRegistry.register(BrokerResponseFactory.ResponseType.BROKER_RESPONSE_TYPE_NATIVE, reduceService);
    reduceServiceRegistry.registerDefault(reduceService);
    return reduceServiceRegistry;
}
Also used : BrokerReduceService(com.linkedin.pinot.core.query.reduce.BrokerReduceService) ReduceServiceRegistry(com.linkedin.pinot.common.query.ReduceServiceRegistry)

Aggregations

BrokerReduceService (com.linkedin.pinot.core.query.reduce.BrokerReduceService)2 ReduceServiceRegistry (com.linkedin.pinot.common.query.ReduceServiceRegistry)1 BrokerRequest (com.linkedin.pinot.common.request.BrokerRequest)1 ServerInstance (com.linkedin.pinot.common.response.ServerInstance)1 DataTable (com.linkedin.pinot.common.utils.DataTable)1 Plan (com.linkedin.pinot.core.plan.Plan)1 HashMap (java.util.HashMap)1