dongjoon-hyun commented on a change in pull request #24178:
[SPARK-25196][SPARK-27251][SQL][FOLLOWUP] Add synchronized for
InMemoryRelation.statsOfPlanToCache
URL: https://github.com/apache/spark/pull/24178#discussion_r268418498
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/columnar/InMemoryRelation.scala
##########
@@ -145,37 +145,60 @@ object InMemoryRelation {
tableName: Option[String],
logicalPlan: LogicalPlan): InMemoryRelation = {
val cacheBuilder = CachedRDDBuilder(useCompression, batchSize,
storageLevel, child, tableName)
- new InMemoryRelation(child.output, cacheBuilder,
logicalPlan.outputOrdering)(
- statsOfPlanToCache = logicalPlan.stats)
+ val relation = new InMemoryRelation(child.output, cacheBuilder,
logicalPlan.outputOrdering)
+ relation.statsOfPlanToCache = logicalPlan.stats
+ relation
}
def apply(cacheBuilder: CachedRDDBuilder, logicalPlan: LogicalPlan):
InMemoryRelation = {
- new InMemoryRelation(cacheBuilder.cachedPlan.output, cacheBuilder,
logicalPlan.outputOrdering)(
- statsOfPlanToCache = logicalPlan.stats)
+ val relation = new InMemoryRelation(
+ cacheBuilder.cachedPlan.output, cacheBuilder, logicalPlan.outputOrdering)
+ relation.statsOfPlanToCache = logicalPlan.stats
+ relation
+ }
+
+ def apply(
+ output: Seq[Attribute],
+ cacheBuilder: CachedRDDBuilder,
+ outputOrdering: Seq[SortOrder],
+ statsOfPlanToCache: Statistics): InMemoryRelation = {
+ val relation = InMemoryRelation(output, cacheBuilder, outputOrdering)
+ relation.statsOfPlanToCache = statsOfPlanToCache
+ relation
}
}
case class InMemoryRelation(
output: Seq[Attribute],
@transient cacheBuilder: CachedRDDBuilder,
- override val outputOrdering: Seq[SortOrder])(
- @volatile var statsOfPlanToCache: Statistics)
+ override val outputOrdering: Seq[SortOrder])
Review comment:
Sorry, but could you explain why we are removing `statsOfPlanToCache` from
here? IIUC, Scala-2.11 issue is just about removing `@volatile`, isn't 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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]