Yaohua628 commented on code in PR #36069:
URL: https://github.com/apache/spark/pull/36069#discussion_r847685784
##########
examples/src/main/python/sql/datasource.py:
##########
@@ -28,12 +28,25 @@
def generic_file_source_options_example(spark: SparkSession) -> None:
# $example on:ignore_corrupt_files$
- # enable ignore corrupt files
+ # enable ignore corrupt files via the data source option
+ # dir1/file3.json is corrupt from parquet's view
+ test_corrupt_df0 = spark.read.option("ignoreCorruptFiles", "true")\
+ .parquet("examples/src/main/resources/dir1/",
+ "examples/src/main/resources/dir1/dir2/")
+ test_corrupt_df0.show()
+ # +-------------+
+ # | file|
+ # +-------------+
+ # |file1.parquet|
+ # |file2.parquet|
+ # +-------------+
+
+ # enable ignore corrupt files via the configuration
spark.sql("set spark.sql.files.ignoreCorruptFiles=true")
# dir1/file3.json is corrupt from parquet's view
- test_corrupt_df = spark.read.parquet("examples/src/main/resources/dir1/",
+ test_corrupt_df1 = spark.read.parquet("examples/src/main/resources/dir1/",
"examples/src/main/resources/dir1/dir2/")
Review Comment:
ah yeah, thanks! fixed it
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]