neilagupta commented on code in PR #36496:
URL: https://github.com/apache/spark/pull/36496#discussion_r869294184


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/columnar/InMemoryRelation.scala:
##########
@@ -238,7 +238,12 @@ case class CachedRDDBuilder(
   }
 
   def isCachedColumnBuffersLoaded: Boolean = {
-    _cachedColumnBuffers != null && isCachedRDDLoaded
+    if (_cachedColumnBuffers != null) {
+      _cachedColumnBuffers.synchronized {
+        return _cachedColumnBuffers != null && isCachedRDDLoaded
+      }
+    }
+    false
   }
 
   def isCachedRDDLoaded: Boolean = {

Review Comment:
   This change is really helpful, is it a good idea to add another synchronized 
block in `isCacheRDDLoaded` too? It seems `_cachedColumnBuffersAreLoaded` is 
also volatile and while there is no other call to `isCacheRDDLoaded`, adding 
that should be safe for another method to call 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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to