You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by GitBox <gi...@apache.org> on 2021/03/29 12:56:56 UTC

[GitHub] [kylin] zzcclp commented on a change in pull request #1619: KYLIN-4936 Exactly aggregation can't transform to project

zzcclp commented on a change in pull request #1619:
URL: https://github.com/apache/kylin/pull/1619#discussion_r603270334



##########
File path: kylin-spark-project/kylin-spark-query/src/main/scala/org/apache/kylin/query/runtime/plans/AggregatePlan.scala
##########
@@ -115,7 +137,7 @@ object AggregatePlan extends LogEx {
         val aggName = SchemaProcessor.replaceToAggravateSchemaName(index, funcName, hash, argNames: _*)
         if (funcName == FunctionDesc.FUNC_COUNT_DISTINCT) {

Review comment:
       Good suggestion. Done

##########
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:
       Done




-- 
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:
users@infra.apache.org