cancel
Showing results for 
Search instead for 
Did you mean: 
Machine Learning
cancel
Showing results for 
Search instead for 
Did you mean: 

File not found error. Does OPTIMIZE deletes initial versions of the delta table?

Data_Analytics1
Contributor III

df = (spark.readStream.format("delta")\

              .option("readChangeFeed", "true")\

              .option("startingVersion", 1)\

              .table("CatalogName.SchemaName.TableName")

             )

display(df)

A file referenced in the transaction log cannot be found. This occurs when data has been manually deleted from the file system rather than using the table `DELETE` statement.

When I see the path of the file, file is not present there. It was neither deleted manually nor Optimized.

Does delta table have any default setting to optimize the table? When I check the history of the table, few records of OPTIMIZE is there and after that OPTIMIZE I was not able to see previous versions of the table though the complete data is available but I cannot see the initial version data of the table.

1 ACCEPTED SOLUTION

Accepted Solutions

swethaNandan
New Contributor III
New Contributor III

Had you run vacuum on the table? Vacuum can clean up data files marked for removal and are older than retention period.

Optimize compacts files and marks the small files for removal, but does not physically remove the data files

View solution in original post

1 REPLY 1

swethaNandan
New Contributor III
New Contributor III

Had you run vacuum on the table? Vacuum can clean up data files marked for removal and are older than retention period.

Optimize compacts files and marks the small files for removal, but does not physically remove the data files

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.