You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/02/01 00:28:42 UTC

[GitHub] [spark] xuanyuanking commented on a change in pull request #27415: [SPARK-30506][SQL][DOC] Document for generic file source options/configs

xuanyuanking commented on a change in pull request #27415: [SPARK-30506][SQL][DOC] Document for generic file source options/configs
URL: https://github.com/apache/spark/pull/27415#discussion_r373739858
 
 

 ##########
 File path: examples/src/main/java/org/apache/spark/examples/sql/JavaSQLDataSourceExample.java
 ##########
 @@ -106,6 +107,43 @@ public static void main(String[] args) {
     spark.stop();
   }
 
+  private static void runGenericFileSourceOptionsExample(SparkSession spark) {
+    // $example on:ignore_corrupt_files$
+    // enable ignore corrupt files
+    spark.sql("set spark.sql.files.ignoreCorruptFiles=true");
+    // dir1/file3.json is corrupt from parquet's view
+    Dataset<Row> testCorruptDF = spark.read().parquet(
+            "examples/src/main/resources/dir1/",
+            "examples/src/main/resources/dir1/dir2/");
+    testCorruptDF.show();
+    // +-------------+
+    // |         file|
+    // +-------------+
+    // |file1.parquet|
+    // |file2.parquet|
+    // +-------------+
+    // $example off:ignore_corrupt_files$
+    spark.sql("set spark.sql.files.ignoreMissingFiles=false");
 
 Review comment:
   I guess setting the config explicitly here is for corresponding with the doc: https://github.com/apache/spark/pull/27415/files#diff-dab20ee598064a54fecef8842b972944R72

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org