@Override public void updateBrokerRequest(BrokerRequest brokerRequest) { Selection selection = new Selection(); List<String> modifiableList = new ArrayList<>(1); modifiableList.add("*"); selection.setSelectionColumns(modifiableList); brokerRequest.setSelections(selection); }
@Test public void testInterSegmentAggregationPlanMaker() { PlanMaker instancePlanMaker = new InstancePlanMakerImplV2(); BrokerRequest brokerRequest = _brokerRequest.deepCopy(); brokerRequest.setSelections(null); brokerRequest.setSelectionsIsSet(false); ExecutorService executorService = Executors.newCachedThreadPool(new NamedThreadFactory("test-plan-maker")); Plan globalPlan = instancePlanMaker.makeInterSegmentPlan( makeSegMgrList(_indexSegmentList), brokerRequest, executorService, 150000); globalPlan.print(); brokerRequest = setFilterQuery(brokerRequest); globalPlan = instancePlanMaker.makeInterSegmentPlan( makeSegMgrList(_indexSegmentList), brokerRequest, executorService, 150000); globalPlan.print(); }
@Test public void testInterSegmentSelectionPlanMaker() throws JSONException { PlanMaker instancePlanMaker = new InstancePlanMakerImplV2(); BrokerRequest brokerRequest = _brokerRequest.deepCopy(); brokerRequest.setAggregationsInfo(null); brokerRequest.setAggregationsInfoIsSet(false); brokerRequest.setSelections(getSelectionQuery()); brokerRequest.getSelections().setOffset(0); brokerRequest.getSelections().setSize(20); ExecutorService executorService = Executors.newCachedThreadPool(new NamedThreadFactory("test-plan-maker")); Plan globalPlan = instancePlanMaker.makeInterSegmentPlan( makeSegMgrList(_indexSegmentList), brokerRequest, executorService, 150000); globalPlan.print(); brokerRequest = setFilterQuery(brokerRequest); globalPlan = instancePlanMaker.makeInterSegmentPlan( makeSegMgrList(_indexSegmentList), brokerRequest, executorService, 150000); globalPlan.print(); globalPlan.execute(); DataTable instanceResponse = globalPlan.getInstanceResponse(); DefaultReduceService defaultReduceService = new DefaultReduceService(); Map<ServerInstance, DataTable> instanceResponseMap = new HashMap<ServerInstance, DataTable>(); instanceResponseMap.put(new ServerInstance("localhost:0000"), instanceResponse); instanceResponseMap.put(new ServerInstance("localhost:1111"), instanceResponse); BrokerResponseJSON brokerResponse = defaultReduceService.reduceOnDataTable(brokerRequest, instanceResponseMap); LOGGER.debug(brokerResponse.getSelectionResults().toString()); LOGGER.debug("Time used: {}", brokerResponse.getTimeUsedMs()); LOGGER.debug(brokerResponse.toString()); JSONArray selectionResultsArray = brokerResponse.getSelectionResults().getJSONArray("results"); for (int j = 0; j < selectionResultsArray.length(); ++j) { LOGGER.debug(selectionResultsArray.getJSONArray(j).toString()); assertEquals(selectionResultsArray.getJSONArray(j).getInt(0), 1); assertEquals(selectionResultsArray.getJSONArray(j).getInt(1), 91); assertEquals(selectionResultsArray.getJSONArray(j).getInt(2) % 100, 91); } }
private static BrokerRequest getSelectionWithFilterBrokerRequest() { BrokerRequest brokerRequest = new BrokerRequest(); brokerRequest.setSelections(getSelectionQuery()); brokerRequest = setFilterQuery(brokerRequest); return brokerRequest; }