You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "sandip-db (via GitHub)" <gi...@apache.org> on 2025/08/08 23:03:33 UTC
Re: [PR] [SPARK-52482][SQL][CORE] Improve exception handling for reading certain corrupt zstd files [spark]
sandip-db commented on code in PR #51916:
URL: https://github.com/apache/spark/pull/51916#discussion_r2264106920
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVSuite.scala:
##########
@@ -3794,6 +3795,29 @@ abstract class CSVSuite
verifyCars(cars, withHeader = true, checkTypes = true)
}
}
+
+ test("corrupted ZSTD compressed csv respects ignoreCorruptFiles") {
+ withTempDir { dir =>
+ val corruptedHeadFile = new File(dir, "corrupted_head.csv.zst")
+ val corruptedTailFile = new File(dir, "corrupted_tail.csv.zst")
+ val bytes = Files.readAllBytes(Paths.get(new URI(testFile(zstCompressedCarsFile))))
+ Files.write(corruptedHeadFile.toPath(), bytes.drop(10))
+ Files.write(corruptedTailFile.toPath(), bytes.dropRight(10))
+
+ withSQLConf(SQLConf.IGNORE_CORRUPT_FILES.key -> "true") {
+ val df = spark.read.format("csv").option("header", "true").load(dir.getAbsolutePath)
+ assert(df.count() == 0)
+ }
+
Review Comment:
Add the non-corrupted file here to `dir` and verify that you are able to read it while ignoring corrupted files.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org