File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
sql/hive/src/test/scala/org/apache/spark/sql/sources Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -516,10 +516,20 @@ abstract class HadoopFsRelationTest extends QueryTest with SQLTestUtils with Tes
516516 .save(subdir)
517517
518518 // Inferring schema should throw error as it should not find any file to infer
519- val e = intercept[AnalysisException ] {
519+ val e = intercept[Exception ] {
520520 sqlContext.read.format(dataSourceName).load(dir)
521521 }
522- assert(e.getMessage.contains(" infer" ))
522+
523+ e match {
524+ case _ : AnalysisException =>
525+ assert(e.getMessage.contains(" infer" ))
526+
527+ case _ : java.util.NoSuchElementException if e.getMessage.contains(" dataSchema" ) =>
528+ // ignore, the source format requires schema to be provided by user
529+
530+ case _ =>
531+ fail(" Unexpected error trying to infer schema from empty dir" , e)
532+ }
523533
524534 /** Test whether data is read with the given path matches the expected answer */
525535 def testWithPath (path : String , expectedAnswer : Seq [Row ]): Unit = {
You can’t perform that action at this time.
0 commit comments