Github user gengliangwang commented on a diff in the pull request:
https://github.com/apache/spark/pull/21769#discussion_r202541358
--- Diff:
external/avro/src/test/scala/org/apache/spark/sql/avro/AvroSuite.scala ---
@@ -680,12 +689,22 @@ class AvroSuite extends QueryTest with
SharedSQLContext with SQLTestUtils {
Files.createFile(new File(tempSaveDir, "non-avro").toPath)
- val newDf = spark
- .read
- .option(AvroFileFormat.IgnoreFilesWithoutExtensionProperty, "true")
- .avro(tempSaveDir)
+ val count = try {
--- End diff --
Nit: consider writing the `try...finally` like this:
```
val hadoopConf = spark.sqlContext.sparkContext.hadoopConfiguration
try {
hadoopConf.set(AvroFileFormat.IgnoreFilesWithoutExtensionProperty,
"true")
val count = spark.read.avro(tempSaveDir).count()
assert(count == 8)
} finally {
hadoopConf.unset(AvroFileFormat.IgnoreFilesWithoutExtensionProperty)
}
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]