Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-18549

Failed to Uncache a View that References a Dropped Table.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 2.0.2
    • 2.1.1, 2.2.0
    • SQL
    • None

    Description

            spark.range(1, 10).toDF("id1").write.format("json").saveAsTable("jt1")
            spark.range(1, 10).toDF("id2").write.format("json").saveAsTable("jt2")
            sql("CREATE VIEW testView AS SELECT * FROM jt1 JOIN jt2 ON id1 == id2")
            // Cache is empty at the beginning
            assert(spark.sharedState.cacheManager.isEmpty)
            sql("CACHE TABLE testView")
            assert(spark.catalog.isCached("testView"))
            // Cache is not empty
            assert(!spark.sharedState.cacheManager.isEmpty)
      
            // drop a table referenced by a cached view
            sql("DROP TABLE jt1")
      
      -- So far everything is fine
      
            // Failed to unache the view
            val e = intercept[AnalysisException] {
              sql("UNCACHE TABLE testView")
            }.getMessage
            assert(e.contains("Table or view not found: `default`.`jt1`"))
      
            // We are unable to drop it from the cache
            assert(!spark.sharedState.cacheManager.isEmpty)
      

      Attachments

        Issue Links

          Activity

            People

              cloud_fan Wenchen Fan
              smilegator Xiao Li
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: