gargvishesh commented on code in PR #16778:
URL: https://github.com/apache/druid/pull/16778#discussion_r1692519375
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/exec/ControllerImpl.java:
##########
@@ -1671,13 +1692,15 @@ private static Function<Set<DataSegment>,
Set<DataSegment>> addCompactionStateTo
: new
ClientCompactionTaskTransformSpec(
dataSchema.getTransformSpec().getFilter()
).asMap(jsonMapper);
- List<Object> metricsSpec = dataSchema.getAggregators() == null
- ? null
- : jsonMapper.convertValue(
- dataSchema.getAggregators(),
- new TypeReference<List<Object>>() {}
- );
+ List<Object> metricsSpec = Collections.emptyList();
+ if (querySpec.getQuery() instanceof GroupByQuery) {
+ // For group-by queries, the aggregators are transformed to their
combining factories in the dataschema, resulting
+ // in a mismatch between schema in compaction spec and the one in
compaction state. Sourcing the metricsSpec
+ // therefore directly from the querySpec.
+ GroupByQuery groupByQuery = (GroupByQuery) querySpec.getQuery();
+ metricsSpec = jsonMapper.convertValue(groupByQuery.getAggregatorSpecs(),
new TypeReference<List<Object>>() {});
Review Comment:
That is because `List<ClassName>` cannot be directly passed as
`List<Object>`. An alternative is to use `new ArrayList<>(List<ClassName>)`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]