imback82 commented on a change in pull request #31273:
URL: https://github.com/apache/spark/pull/31273#discussion_r568167394



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/CacheManager.scala
##########
@@ -159,11 +159,19 @@ class CacheManager extends Logging with 
AdaptiveSparkPlanHelper {
       plan: LogicalPlan,
       cascade: Boolean,
       blocking: Boolean = false): Unit = {
+    val analyzedPlan = if (plan.resolved) {
+      plan
+    } else {
+      val qe = spark.sessionState.executePlan(plan)
+      qe.assertAnalyzed()

Review comment:
       ```
   sql("CACHE TABLE t1 AS SELECT * FROM testData")
   sql("UNCACHE TABLE t1")
   ```
   `t1` passed to `uncacheQuery` is:
   ```
   'SubqueryAlias t1
   +- View (`t1`, ['key,'value])
      +- 'Project [upcast('key, IntegerType) AS key#293, upcast('value, 
StringType) AS value#294]
         +- 'Project [*]
            +- 'UnresolvedRelation [testData], [], false
   ```
   Now that temporary views are always resolved, we need to resolve `t1` in 
this case.
   
   Note that we couldn't make the table of `CacheTable`/`UncacheTable` as a 
child due to https://github.com/apache/spark/pull/30598#discussion_r536384428.
   




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to