ravipesala commented on a change in pull request #3150: [CARBONDATA-3309] MV datamap supports Spark 2.1
URL:
https://github.com/apache/carbondata/pull/3150#discussion_r285385558
##########
File path: datamap/mv/plan/src/main/scala/org/apache/carbondata/mv/plans/modular/AggregatePushDown.scala
##########
@@ -106,12 +106,14 @@ trait AggregatePushDown { // self: ModularPlan =>
} else {
Map.empty[Int, (NamedExpression, Seq[NamedExpression])]
}
- case sum@AggregateExpression(Sum(Cast(expr, dataType, timeZoneId)), _, false, _)
- if expr.isInstanceOf[Attribute] =>
- val tAttr = selAliasMap.get(expr.asInstanceOf[Attribute]).getOrElse(expr)
+ case sum@AggregateExpression(Sum(child), _, false, _)
Review comment:
Please try the following code
```
case sum@AggregateExpression(Sum(cast@MatchCast(expr, dataType)), _, false, _) =>
val tAttr = selAliasMap.get(expr.asInstanceOf[Attribute]).getOrElse(expr)
.asInstanceOf[Attribute]
if (fact.outputSet.contains(tAttr)) {
val sum1 = AggregateExpression(Sum(cast), sum.mode, false)
val alias = Alias(sum1, sum1.toString)()
val tSum = AggregateExpression(Sum(alias.toAttribute), sum.mode, false, sum.resultId)
val (name, id) = aliasInfo.getOrElse(("", NamedExpression.newExprId))
map += (ith -> (Alias(tSum, name)(exprId = id), Seq(alias)))
} else {
Map.empty[Int, (NamedExpression, Seq[NamedExpression])]
}
```
----------------------------------------------------------------
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