[GitHub] [carbondata] ravipesala commented on a change in pull request #3297: [CARBONDATA-3444]Fix MV query failure when column name and table name is same in case of join scenario

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 #3297: [CARBONDATA-3444]Fix MV query failure when column name and table name is same in case of join scenario

GitBox
ravipesala commented on a change in pull request #3297: [CARBONDATA-3444]Fix MV query failure when column name and table name is same in case of join scenario
URL: https://github.com/apache/carbondata/pull/3297#discussion_r295181512
 
 

 ##########
 File path: datamap/mv/plan/src/main/scala/org/apache/carbondata/mv/plans/util/Logical2ModularExtractions.scala
 ##########
 @@ -146,6 +148,37 @@ object ExtractSelectModule extends PredicateHelper {
     }
   }
 
+  // The project node is removed before Join node by the rule PushProjectionThroughUnion for logical
+  // plan optimization, and plan will be as below for example
+  //Join Inner, (product#507 = product#509)
+  //:- Relation...
+  //+- Relation...
+  // in scenario where column names will be same for diff table, if the select node is formed
+  // without the qualifier name, it fails during logical plan generation from rewritten query, as
+  // column names will be ambigous, so handle here to add the qualifier name to expressions
+  def updateOutputListOfJoin(output: Seq[Attribute], condition: Seq[Expression]): Seq[Attribute] = {
+    val fieldsInCondition = condition.collect {
+      case a: Expression => a.children.collect {
+        case a: AttributeReference =>
+          a.toAttribute
+      }
+    }.flatten
+    if (condition.nonEmpty && fieldsInCondition.nonEmpty) {
+      val substitutedOutputs: Seq[Attribute] = output.map {
+        col =>
 
 Review comment:
   move up

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