Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-33507 Improve and fix cache behavior in v1 and v2
  3. SPARK-34027

ALTER TABLE .. RECOVER PARTITIONS doesn't refresh cache

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.1, 3.1.0, 3.2.0
    • 3.0.2, 3.1.1, 3.2.0
    • SQL

    Description

      Here is the example to reproduce the issue:

      spark-sql> create table tbl (col int, part int) using parquet partitioned by (part);
      spark-sql> insert into tbl partition (part=0) select 0;
      spark-sql> cache table tbl;
      spark-sql> select * from tbl;
      0	0
      spark-sql> show table extended like 'tbl' partition(part=0);
      default	tbl	false	Partition Values: [part=0]
      Location: file:/Users/maximgekk/proj/recover-partitions-refresh-cache/spark-warehouse/tbl/part=0
      ...
      

      Add new partition by copying the existing one:

      cp -r /Users/maximgekk/proj/recover-partitions-refresh-cache/spark-warehouse/tbl/part=0 /Users/maximgekk/proj/recover-partitions-refresh-cache/spark-warehouse/tbl/part=1
      

       Recover and select the table:

      spark-sql> alter table tbl recover partitions;
      spark-sql> select * from tbl;
      0	0
      

      We see only old data.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: