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/26 07:36:29 UTC

[GitHub] [kylin] zzcclp opened a new pull request #1619: KYLIN-4936 Exactly aggregation can't transform to project

zzcclp opened a new pull request #1619:
URL: https://github.com/apache/kylin/pull/1619


   ## Proposed changes
   
   Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.
   
   ## Types of changes
   
   What types of changes does your code introduce to Kylin?
   _Put an `x` in the boxes that apply_
   
   - [ ] Bugfix (non-breaking change which fixes an issue)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
   - [ ] Documentation Update (if none of the other choices apply)
   
   ## Checklist
   
   _Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._
   
   - [ ] I have create an issue on [Kylin's jira](https://issues.apache.org/jira/browse/KYLIN), and have described the bug/feature there in detail
   - [ ] Commit messages in my PR start with the related jira ID, like "KYLIN-0000 Make Kylin project open-source"
   - [ ] Compiling and unit tests pass locally with my changes
   - [ ] I have added tests that prove my fix is effective or that my feature works
   - [ ] If this change need a document change, I will prepare another pr against the `document` branch
   - [ ] Any dependent changes have been merged
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at user@kylin or dev@kylin by explaining why you chose the solution you did and what alternatives you considered, etc...
   


-- 
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



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

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org



[GitHub] [kylin] hit-lacus merged pull request #1619: KYLIN-4936 Exactly aggregation can't transform to project

Posted by GitBox <gi...@apache.org>.
hit-lacus merged pull request #1619:
URL: https://github.com/apache/kylin/pull/1619


   


-- 
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



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

Posted by GitBox <gi...@apache.org>.
zhengshengjun commented on a change in pull request #1619:
URL: https://github.com/apache/kylin/pull/1619#discussion_r602889056



##########
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:
       should we replace "funcName == FunctionDesc.FUNC_COUNT_DISTINCT" with call.getFunc.isCountDistinct  ?




-- 
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



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

Posted by GitBox <gi...@apache.org>.
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



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

Posted by GitBox <gi...@apache.org>.
zhengshengjun commented on pull request #1619:
URL: https://github.com/apache/kylin/pull/1619#issuecomment-808908852


   Thanks for solving this problem we've met. I have tested and it perfectly addressed our problem. 


-- 
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