This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-2.4 by this push:
     new e73acc5  Revert "[SPARK-33228][SQL] Don't uncache data when replacing 
a view having the same logical plan
e73acc5 is described below

commit e73acc50bf1ad5af4b591d7f8594d71ab5b7fac5
Author: Liang-Chi Hsieh <[email protected]>
AuthorDate: Mon Oct 26 12:37:23 2020 -0700

    Revert "[SPARK-33228][SQL] Don't uncache data when replacing a view having 
the same logical plan
    
    This reverts commit a85d69049c5ad994b3fb6cde1b3d739f3da336d4.
    
    Closes #30152 from viirya/revert-33228.
    
    Authored-by: Liang-Chi Hsieh <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 .../apache/spark/sql/execution/command/views.scala | 10 ++++-----
 .../org/apache/spark/sql/CachedTableSuite.scala    | 24 ----------------------
 2 files changed, 4 insertions(+), 30 deletions(-)

diff --git 
a/sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala 
b/sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
index 9cb4003..5d9f2c3 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
@@ -143,19 +143,17 @@ case class CreateViewCommand(
 
     val catalog = sparkSession.sessionState.catalog
     if (viewType == LocalTempView) {
-      if (replace && catalog.getTempView(name.table).isDefined &&
-          !catalog.getTempView(name.table).get.sameResult(child)) {
-        logInfo(s"Try to uncache ${name.quotedString} before replacing.")
+      if (replace && catalog.getTempView(name.table).isDefined) {
+        logDebug(s"Try to uncache ${name.quotedString} before replacing.")
         CommandUtils.uncacheTableOrView(sparkSession, name.quotedString)
       }
       val aliasedPlan = aliasPlan(sparkSession, analyzedPlan)
       catalog.createTempView(name.table, aliasedPlan, overrideIfExists = 
replace)
     } else if (viewType == GlobalTempView) {
-      if (replace && catalog.getGlobalTempView(name.table).isDefined &&
-          !catalog.getGlobalTempView(name.table).get.sameResult(child)) {
+      if (replace && catalog.getGlobalTempView(name.table).isDefined) {
         val db = 
sparkSession.sessionState.conf.getConf(StaticSQLConf.GLOBAL_TEMP_DATABASE)
         val globalTempView = TableIdentifier(name.table, Option(db))
-        logInfo(s"Try to uncache ${globalTempView.quotedString} before 
replacing.")
+        logDebug(s"Try to uncache ${globalTempView.quotedString} before 
replacing.")
         CommandUtils.uncacheTableOrView(sparkSession, 
globalTempView.quotedString)
       }
       val aliasedPlan = aliasPlan(sparkSession, analyzedPlan)
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/CachedTableSuite.scala 
b/sql/core/src/test/scala/org/apache/spark/sql/CachedTableSuite.scala
index 28c0fa4..5c8c857 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/CachedTableSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/CachedTableSuite.scala
@@ -907,28 +907,4 @@ class CachedTableSuite extends QueryTest with SQLTestUtils 
with SharedSQLContext
       assert(spark.sharedState.cacheManager.isEmpty)
     }
   }
-
-  test("SPARK-33228: Don't uncache data when replacing an existing view having 
the same plan") {
-    withTempView("tempView") {
-      spark.catalog.clearCache()
-      val df = spark.range(1).selectExpr("id a", "id b")
-      df.cache()
-      assert(spark.sharedState.cacheManager.lookupCachedData(df).isDefined)
-      df.createOrReplaceTempView("tempView")
-      assert(spark.sharedState.cacheManager.lookupCachedData(df).isDefined)
-      df.createOrReplaceTempView("tempView")
-      assert(spark.sharedState.cacheManager.lookupCachedData(df).isDefined)
-    }
-
-    withTempView("tempGlobalTempView") {
-      spark.catalog.clearCache()
-      val df = spark.range(1).selectExpr("id a", "id b")
-      df.cache()
-      assert(spark.sharedState.cacheManager.lookupCachedData(df).isDefined)
-      df.createOrReplaceGlobalTempView("tempGlobalTempView")
-      assert(spark.sharedState.cacheManager.lookupCachedData(df).isDefined)
-      df.createOrReplaceGlobalTempView("tempGlobalTempView")
-      assert(spark.sharedState.cacheManager.lookupCachedData(df).isDefined)
-    }
-  }
 }


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

Reply via email to