Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert tests for hadoop's config
  • Loading branch information
MaxGekk committed Jul 17, 2018
commit d07ced332ba04ac18f270962d887f1e19e9155ec
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,19 @@ class AvroSuite extends QueryTest with SharedSQLContext with SQLTestUtils {
spark.read.avro("*/*/*/*/*/*/*/something.avro")
}

intercept[FileNotFoundException] {
withTempPath { dir =>
FileUtils.touch(new File(dir, "test"))
val hadoopConf = spark.sqlContext.sparkContext.hadoopConfiguration
try {
hadoopConf.set(AvroFileFormat.IgnoreFilesWithoutExtensionProperty, "true")
spark.read.avro(dir.toString)
} finally {
hadoopConf.unset(AvroFileFormat.IgnoreFilesWithoutExtensionProperty)
}
}
}

intercept[FileNotFoundException] {
withTempPath { dir =>
FileUtils.touch(new File(dir, "test"))
Expand All @@ -630,7 +643,6 @@ class AvroSuite extends QueryTest with SharedSQLContext with SQLTestUtils {
.avro(dir.toString)
}
}

}

test("SQL test insert overwrite") {
Expand Down Expand Up @@ -689,6 +701,18 @@ class AvroSuite extends QueryTest with SharedSQLContext with SQLTestUtils {

Files.createFile(new File(tempSaveDir, "non-avro").toPath)

val hadoopConf = spark.sqlContext.sparkContext.hadoopConfiguration
val count = try {
hadoopConf.set(AvroFileFormat.IgnoreFilesWithoutExtensionProperty, "true")
val newDf = spark
.read
.avro(tempSaveDir)
newDf.count()
} finally {
hadoopConf.unset(AvroFileFormat.IgnoreFilesWithoutExtensionProperty)
}
assert(count == 8)

val newDf = spark
.read
.option("ignoreExtension", false)
Expand Down