Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-33392 Align DSv2 commands to DSv1 implementation
  3. SPARK-33987

v2 ALTER TABLE .. DROP PARTITION does not refresh cached table

Attach filesAttach ScreenshotVotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.2.0
    • 3.2.0
    • SQL
    • None

    Description

      The test below portraits the issue:

        test("SPARK-33950: refresh cache after partition dropping") {
          withNamespaceAndTable("ns", "tbl") { t =>
            sql(s"CREATE TABLE $t (id int, part int) $defaultUsing PARTITIONED BY (part)")
            sql(s"INSERT INTO $t PARTITION (part=0) SELECT 0")
            sql(s"INSERT INTO $t PARTITION (part=1) SELECT 1")
            assert(!spark.catalog.isCached(t))
            sql(s"CACHE TABLE $t")
            assert(spark.catalog.isCached(t))
            QueryTest.checkAnswer(sql(s"SELECT * FROM $t"), Seq(Row(0, 0), Row(1, 1)))
            sql(s"ALTER TABLE $t DROP PARTITION (part=0)")
            assert(spark.catalog.isCached(t))
            QueryTest.checkAnswer(sql(s"SELECT * FROM $t"), Seq(Row(1, 1)))
          }
        }
      

      The last check fails:

      == Results ==
      !== Correct Answer - 1 ==   == Spark Answer - 2 ==
      !struct<>                   struct<id:int,part:int>
      ![1,1]                      [0,0]
      !                           [1,1]
      

       

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            maxgekk Max Gekk
            maxgekk Max Gekk
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment