[ https://issues.apache.org/jira/browse/KYLIN-4936?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17310223#comment-17310223 ]
ASF GitHub Bot commented on KYLIN-4936: --------------------------------------- zhengshengjun commented on a change in pull request #1619: URL: https://github.com/apache/kylin/pull/1619#discussion_r602889485 ########## File path: kylin-spark-project/kylin-spark-query/src/main/scala/org/apache/kylin/query/runtime/plans/AggregatePlan.scala ########## @@ -53,10 +53,32 @@ object AggregatePlan extends LogEx { .map(groupId => col(schemaNames.apply(groupId))) .toList - if (rel.getContext != null && rel.getContext.isExactlyAggregate) { + rel.getContext.isExactlyAggregate = isExactlyCuboidMatched(rel, groupList) + if (rel.getContext.isExactlyAggregate) { // exactly match, skip agg, direct project. - val aggCols = rel.getRewriteAggCalls.asScala - .map(call => col(schemaNames.apply(call.getArgList.get(0)))).toList + val hash = System.identityHashCode(rel).toString + val aggCols = rel.getRewriteAggCalls.asScala.zipWithIndex.map { + case (call: KylinAggregateCall, index: Int) + if OLAPAggregateRel.getAggrFuncName(call).equals("COUNT_DISTINCT") => + val dataType = call.getFunc.getReturnDataType + val funcName = OLAPAggregateRel.getAggrFuncName(call) + val argNames = call.getArgList.asScala.map(dataFrame.schema.names.apply(_)) + val columnName = argNames.map(col) + val aggName = SchemaProcessor.replaceToAggravateSchemaName(index, funcName, hash, argNames: _*) + if (dataType.getName == "hllc") { Review comment: What about adding a 'isHLLCountDistinct' method in FunctionDesc, sometimes I have trouble judging whether this count_distinct function is HLL or precise count distinct == -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Exactly aggregation can't transform to project > ---------------------------------------------- > > Key: KYLIN-4936 > URL: https://issues.apache.org/jira/browse/KYLIN-4936 > Project: Kylin > Issue Type: Improvement > Components: Query Engine > Affects Versions: v4.0.0-beta > Reporter: ShengJun Zheng > Assignee: Zhichao Zhang > Priority: Major > Fix For: v4.0.0-GA > > > Exactly Aggregate can't transform to project, causing unnecessary spark > shuffle ! -- This message was sent by Atlassian Jira (v8.3.4#803005)