@@ -655,4 +655,35 @@ class OrcQuerySuite extends OrcQueryTest with SharedSQLContext {
655
655
}
656
656
}
657
657
}
658
+
659
+ testQuietly(" Enabling/disabling ignoreMissingFiles" ) {
660
+ def testIgnoreMissingFiles (): Unit = {
661
+ withTempDir { dir =>
662
+ val basePath = dir.getCanonicalPath
663
+ spark.range(1 ).toDF(" a" ).write.orc(new Path (basePath, " first" ).toString)
664
+ spark.range(1 , 2 ).toDF(" a" ).write.orc(new Path (basePath, " second" ).toString)
665
+ val thirdPath = new Path (basePath, " third" )
666
+ spark.range(2 , 3 ).toDF(" a" ).write.orc(thirdPath.toString)
667
+ val df = spark.read.orc(
668
+ new Path (basePath, " first" ).toString,
669
+ new Path (basePath, " second" ).toString,
670
+ new Path (basePath, " third" ).toString)
671
+
672
+ val fs = thirdPath.getFileSystem(spark.sparkContext.hadoopConfiguration)
673
+ fs.delete(thirdPath, true )
674
+ checkAnswer(df, Seq (Row (0 ), Row (1 )))
675
+ }
676
+ }
677
+
678
+ withSQLConf(SQLConf .IGNORE_MISSING_FILES .key -> " true" ) {
679
+ testIgnoreMissingFiles()
680
+ }
681
+
682
+ withSQLConf(SQLConf .IGNORE_MISSING_FILES .key -> " false" ) {
683
+ val exception = intercept[SparkException ] {
684
+ testIgnoreMissingFiles()
685
+ }
686
+ assert(exception.getMessage().contains(" does not exist" ))
687
+ }
688
+ }
658
689
}
0 commit comments