aokolnychyi commented on code in PR #57799:
URL: https://github.com/apache/spark/pull/57799#discussion_r3776395011


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/RelationResolution.scala:
##########
@@ -476,23 +489,60 @@ class RelationResolution(
 
   def resolveReference(ref: V2TableReference): LogicalPlan = {
     val relation = if (ref.context.cacheable) {
-      getOrLoadRelation(ref)
+      val useSharedRelationCache =
+        ref.context.isInstanceOf[V2TableReference.TemporaryViewContext]
+      getOrLoadRelation(ref, useSharedRelationCache)

Review Comment:
   I understand now but I don't like the instance of check. Can we instead add 
a new method to the reference?
   
   ```
   sealed trait Context {
     /** Whether re-resolution may reuse the per-query relation cache. */
     def cacheable: Boolean
   
     /** Whether re-resolution may reuse the shared (CACHE TABLE) relation 
cache. */
     def sharedCacheable: Boolean
   }
   ```
   
   Then we can get rid of the useSharedRelationCache argument and just check 
ref.sharedCacheable inside.



-- 
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