jihoonson commented on a change in pull request #5471: Implement force push down for nested group by query URL: https://github.com/apache/incubator-druid/pull/5471#discussion_r204904671
########## File path: processing/src/main/java/io/druid/query/groupby/epinephelinae/GroupByRowProcessor.java ########## @@ -66,18 +69,28 @@ final GroupByQueryResource resource, final ObjectMapper spillMapper, final String processingTmpDir, - final int mergeBufferSize + final int mergeBufferSize, + final boolean wasQueryPushedDown ) { - final GroupByQuery query = (GroupByQuery) queryParam; + GroupByQuery queryWithRenamedDimensions = null; + if (wasQueryPushedDown) { + List<DimensionSpec> newDims = new ArrayList<>(((GroupByQuery) queryParam).getDimensions().size()); + for (DimensionSpec ds : ((GroupByQuery) queryParam).getDimensions()) { + DimensionSpec dim = new PushDownQueryDimensionSpec(ds); + newDims.add(dim); + } + queryWithRenamedDimensions = ((GroupByQuery) queryParam).withDimensionSpecs(newDims); + } + final GroupByQuery query = wasQueryPushedDown ? queryWithRenamedDimensions : (GroupByQuery) queryParam; final GroupByQueryConfig querySpecificConfig = config.withOverrides(query); final AggregatorFactory[] aggregatorFactories = new AggregatorFactory[query.getAggregatorSpecs().size()]; for (int i = 0; i < query.getAggregatorSpecs().size(); i++) { - aggregatorFactories[i] = query.getAggregatorSpecs().get(i); + AggregatorFactory af = query.getAggregatorSpecs().get(i); + aggregatorFactories[i] = wasQueryPushedDown ? af.getCombiningFactory() : af; Review comment: Thanks. Can we this kind of query rewriting for dimensions and aggregatorFactories in `GroupByQueryQueryToolChect.getResultsOnPushDown()`? It would be better because we can put necessary stuffs for nestedQueryPushDown together when `isNestedQueryPushDown()` is checked. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@druid.apache.org For additional commands, e-mail: dev-h...@druid.apache.org