04-17-2023 07:14 AM
I am using the delta format and occasionaly get the following error:-
"xx.parquet 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"
FSCK REPAIR TABLE works for Hive based tables, but I am using the file system only.
How can I re-create the delta transaction log (rather than rebuilding the whole dataset)?
04-17-2023 11:35 PM
Hi, Please refer to https://kb.databricks.com/delta/filereadexception-when-reading-delta-table.
Please let us know if this helps.
Also, please tag @Debayan Mukherjee with your next response which will notify me. Thank you!
04-18-2023 12:39 AM
Hi @Dean Lovelace
Thank you for posting your question in our community! We are happy to assist you.
To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?
This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance!
04-19-2023 07:40 AM
## Delta check when a file was added
%scala
(oldest-version-available to newest-version-available).map { version =>
var df = spark.read.json(f"<delta-table-location>/_delta_log/$version%020d.json").where("add is not null").select("add.path")
var df2 = df.filter('path.contains("name-of-the-parquet-file"))
if (df2.count > 0) {
print("********* " + version)
}
}
@Dean Lovelace - Please use the above code snippet to identify in which available version the file is present.
change oldest-version-available to newest-version-available for the numbers of the delta History that you would like to check change the delta path to your delta table.
If you are facing this issue while reading (after doing FSCK REPAIR), could you please try using the below config.
spark.sql.files.ignoreCorruptFiles true
spark.sql.files.ignoreMissingFiles true
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.