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_r296077013
##########
File path: datamap/mv/core/src/main/scala/org/apache/carbondata/mv/datamap/MVUtil.scala
##########
@@ -310,4 +310,35 @@ object MVUtil {
" are not allowed for this datamap")
}
}
+
+ def updateDuplicateColumns(outputList: Seq[NamedExpression]): Seq[NamedExpression] = {
+ val duplicateNameCols = outputList.groupBy(_.name).filter(_._2.length > 1).flatMap(_._2)
+ .toList
+ val updatedOutList = outputList.map { col =>
+ val duplicateColumn = duplicateNameCols
+ .find(a => a.semanticEquals(col))
+ val qualifiedName = col.qualifier.getOrElse(s"${ col.name }_${ col.exprId.id }")
+ if (duplicateColumn.isDefined) {
+ val attributesOfDuplicateCol = duplicateColumn.get.collect {
+ case a: AttributeReference => a
+ }
+ val attributeOfCol = col.collect { case a: AttributeReference => a }
+ val isStrictDuplicate = attributesOfDuplicateCol.forall(expr =>
+ attributeOfCol.exists(a => a.semanticEquals(expr)))
+ if (!isStrictDuplicate) {
Review comment:
This `isStrictDuplicate` part is not clear the need of it, please add some comments to it.
----------------------------------------------------------------
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