Skip to content

Commit f15ee32

Browse files
committed
Fixed tests
1 parent efd261f commit f15ee32

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sql/hive/src/test/scala/org/apache/spark/sql/sources/HadoopFsRelationTest.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,6 @@ abstract class HadoopFsRelationTest extends QueryTest with SQLTestUtils with Tes
514514
.mode(SaveMode.Overwrite)
515515
.save(subdir.getCanonicalPath)
516516

517-
require(subdir.exists)
518-
require(subdir.listFiles().exists(!_.isDirectory))
519-
520517
// Inferring schema should throw error as it should not find any file to infer
521518
val e = intercept[Exception] {
522519
sqlContext.read.format(dataSourceName).load(dir.getCanonicalPath)
@@ -544,14 +541,17 @@ abstract class HadoopFsRelationTest extends QueryTest with SQLTestUtils with Tes
544541

545542
// Verify that reading by path 'dir/' gives empty results as there are no files in 'file'
546543
// and it should not pick up files in 'dir/subdir'
544+
require(subdir.exists)
545+
require(subdir.listFiles().exists(!_.isDirectory))
547546
testWithPath(dir, Seq.empty)
548547

549548
// Verify that if there is data in dir, then reading by path 'dir/' reads only dataInDir
550549
dataInDir.write
551550
.format(dataSourceName)
552-
.mode(SaveMode.Ignore)
551+
.mode(SaveMode.Append) // append to prevent subdir from being deleted
553552
.save(dir.getCanonicalPath)
554553
require(dir.listFiles().exists(!_.isDirectory))
554+
require(subdir.exists())
555555
require(subdir.listFiles().exists(!_.isDirectory))
556556
testWithPath(dir, dataInDir.collect())
557557
}

0 commit comments

Comments
 (0)