ravipesala commented on a change in pull request #3129: [CARBONDATA-3295] Fix
that MV datamap throw exception because its rewrite algorithm when query SQL
has multiply subquery
URL: https://github.com/apache/carbondata/pull/3129#discussion_r282845145
##########
File path:
datamap/mv/core/src/main/scala/org/apache/carbondata/mv/datamap/MVHelper.scala
##########
@@ -596,12 +596,20 @@ object MVHelper {
case g: GroupBy =>
MVHelper.updateDataMap(g, rewrite)
}
- // TODO Find a better way to set the rewritten flag, it may fail in some
conditions.
- val mapping =
- rewrittenPlan.collect { case m: ModularPlan => m } zip
- updatedDataMapTablePlan.collect { case m: ModularPlan => m }
- mapping.foreach(f => if (f._1.rewritten) f._2.setRewritten())
+ // Use coarse equal to set the rewritten flag
+ // We may change the ModularPlan relation
+ // So we match the node excluding child comparison
+ updatedDataMapTablePlan.map(plan => {
+ if (rewrittenPlan.find (
+ oriPlan => oriPlan.rewritten && (plan match {
+ case select: Select => select.coarseEqual(oriPlan)
Review comment:
The above can copy the rewritten flag during transformation itself so need
to do equals check.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services