[GitHub] [carbondata] ravipesala commented on a change in pull request #3120: [CARBONDATA-3286] MV datamap doesn't take effect when query SQL has coalesce with all projections and no filter condition

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] ravipesala commented on a change in pull request #3120: [CARBONDATA-3286] MV datamap doesn't take effect when query SQL has coalesce with all projections and no filter condition

GitBox
ravipesala commented on a change in pull request #3120: [CARBONDATA-3286] MV datamap doesn't take effect when query SQL has coalesce with all projections and no filter condition
URL: https://github.com/apache/carbondata/pull/3120#discussion_r280745517
 
 

 ##########
 File path: datamap/mv/core/src/main/scala/org/apache/carbondata/mv/rewrite/DefaultMatchMaker.scala
 ##########
 @@ -354,6 +354,30 @@ object SelectSelectNoChildDelta extends DefaultMatchPattern with PredicateHelper
 }
 
 object GroupbyGroupbyNoChildDelta extends DefaultMatchPattern {
+  def  tryMatch(gb_2a: GroupBy,
+               gb_2q: GroupBy,
+               isGroupingEmR: Boolean,
+                isInheritTableRelation: Boolean) : Seq[ModularPlan] = {
+    val aliasMap = AttributeMap(gb_2a.outputList.collect { case a: Alias =>
+      (a.toAttribute, a)})
+    if (isGroupingEmR) {
+      Utils.tryMatch(
+        gb_2a, gb_2q, aliasMap).flatMap {
+        case g: GroupBy =>
+          Some(g.copy(child = g.child.withNewChildren(
+            g.child.children.map {
+              case modular.Select(_, _, _, _, _, _, _, _, _, _) => gb_2a;
+              case other => other
+            }), dataMapTableRelation =
+            if (isInheritTableRelation) gb_2a.dataMapTableRelation
 
 Review comment:
   It is sort of hack, we should not copy the `dataMapTableRelation` like this. Actual matching should happen and the whole plan should be replaced not just `dataMapTableRelation`.

----------------------------------------------------------------
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:
[hidden email]


With regards,
Apache Git Services