qiuchenjian 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_r283659839
##########
File path: datamap/mv/plan/src/main/scala/org/apache/carbondata/mv/plans/modular/ModularRelation.scala
##########
@@ -47,14 +47,7 @@ case class ModularRelation(databaseName: String,
override def computeStats(spark: SparkSession, conf: SQLConf): Statistics = {
val plan = spark.table(s"${ databaseName }.${ tableName }").queryExecution.optimizedPlan
val stats = SparkSQLUtil.invokeStatsMethod(plan, conf)
- val output = outputList.map(_.toAttribute)
- val mapSeq = plan.collect { case n: logical.LeafNode => n }.map {
- table => AttributeMap(table.output.zip(output))
- }
- val rewrites = mapSeq(0)
- val attributeStats = AttributeMap(stats.attributeStats.iterator
- .map { pair => (rewrites(pair._1), pair._2) }.toSeq)
- Statistics(stats.sizeInBytes, stats.rowCount, attributeStats, stats.hints)
+ SparkSQLUtil.getStatisticsObj(outputList, plan, stats)
Review comment:
Do we add the same code to spark 2.3 CarbonToSparkAdapater.scala? or we add a common CarbonToSparkAdapater.scala to "commonTo2.2And2.3"?
Most of this code is different between spark2.1 and spark 2.2 & 2.3, so i think using reflections is OKļ¼can we keep this code??
----------------------------------------------------------------
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