@Test public void testNoFilter() { String query = "SELECT * FROM testTable"; BrokerRequest sqlBrokerRequest = SQL_COMPILER.compileToBrokerRequest(query); PinotQuery pinotQuery = sqlBrokerRequest.getPinotQuery(); BrokerRequest pqlBrokerRequest = PQL_COMPILER.compileToBrokerRequest(query); OPTIMIZER.optimize(sqlBrokerRequest, SCHEMA); assertNull(sqlBrokerRequest.getFilterQuery()); OPTIMIZER.optimize(pinotQuery, SCHEMA); assertNull(pinotQuery.getFilterExpression()); OPTIMIZER.optimize(pqlBrokerRequest, SCHEMA); assertNull(pqlBrokerRequest.getFilterQuery()); }
public void optimize(BrokerRequest brokerRequest, @Nullable Schema schema) { FilterQuery filterQuery = brokerRequest.getFilterQuery(); if (filterQuery != null) { FilterQueryTree filterQueryTree = RequestUtils.buildFilterQuery(filterQuery.getId(), brokerRequest.getFilterSubQueryMap().getFilterQueryMap()); for (FilterOptimizer filterOptimizer : FILTER_OPTIMIZERS) { filterQueryTree = filterOptimizer.optimize(filterQueryTree, schema); } RequestUtils.generateFilterFromTree(filterQueryTree, brokerRequest); } }
QueryOptimizer { public void optimize(BrokerRequest brokerRequest, @Nullable Schema schema) { FilterQuery filterQuery = brokerRequest.getFilterQuery(); if (filterQuery != null) { FilterQueryTree filterQueryTree = RequestUtils.buildFilterQuery(filterQuery.getId(), brokerRequest.getFilterSubQueryMap().getFilterQueryMap()); for (FilterOptimizer filterOptimizer : FILTER_OPTIMIZERS) { filterQueryTree = filterOptimizer.optimize(filterQueryTree, schema); } RequestUtils.generateFilterFromTree(filterQueryTree, brokerRequest); } } }
QueryOptimizer { public void optimize(BrokerRequest brokerRequest, @Nullable Schema schema) { FilterQuery filterQuery = brokerRequest.getFilterQuery(); if (filterQuery != null) { FilterQueryTree filterQueryTree = RequestUtils.buildFilterQuery(filterQuery.getId(), brokerRequest.getFilterSubQueryMap().getFilterQueryMap()); for (FilterOptimizer filterOptimizer : FILTER_OPTIMIZERS) { filterQueryTree = filterOptimizer.optimize(filterQueryTree, schema); } RequestUtils.generateFilterFromTree(filterQueryTree, brokerRequest); } }  }
QueryOptimizer { public void optimize(BrokerRequest brokerRequest, @Nullable Schema schema) { FilterQuery filterQuery = brokerRequest.getFilterQuery(); if (filterQuery != null) { FilterQueryTree filterQueryTree = RequestUtils.buildFilterQuery(filterQuery.getId(), brokerRequest.getFilterSubQueryMap().getFilterQueryMap()); for (FilterOptimizer filterOptimizer : FILTER_OPTIMIZERS) { filterQueryTree = filterOptimizer.optimize(filterQueryTree, schema); } RequestUtils.generateFilterFromTree(filterQueryTree, brokerRequest); } }  void optimize(BrokerRequest brokerRequest, @Nullable Schema schema); void optimize(PinotQuery pinotQuery, @Nullable Schema schema); }
QueryOptimizer { public void optimize(BrokerRequest brokerRequest, @Nullable Schema schema) { FilterQuery filterQuery = brokerRequest.getFilterQuery(); if (filterQuery != null) { FilterQueryTree filterQueryTree = RequestUtils.buildFilterQuery(filterQuery.getId(), brokerRequest.getFilterSubQueryMap().getFilterQueryMap()); for (FilterOptimizer filterOptimizer : FILTER_OPTIMIZERS) { filterQueryTree = filterOptimizer.optimize(filterQueryTree, schema); } RequestUtils.generateFilterFromTree(filterQueryTree, brokerRequest); } }  void optimize(BrokerRequest brokerRequest, @Nullable Schema schema); void optimize(PinotQuery pinotQuery, @Nullable Schema schema);  }