Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/22611#discussion_r222166950
  
    --- Diff: 
external/avro/src/main/scala/org/apache/spark/sql/avro/AvroFileFormat.scala ---
    @@ -100,6 +77,50 @@ private[avro] class AvroFileFormat extends FileFormat
         }
       }
     
    +  private def inferAvroSchemaFromFiles(
    +      files: Seq[FileStatus],
    +      conf: Configuration,
    +      ignoreExtension: Boolean): Schema = {
    +    val ignoreCorruptFiles = SQLConf.get.ignoreCorruptFiles
    +    // Schema evolution is not supported yet. Here we only pick first 
random readable sample file to
    +    // figure out the schema of the whole dataset.
    +    val avroReader = files.iterator.map { f =>
    +      val path = f.getPath
    +      if (!ignoreExtension && !path.getName.endsWith(".avro")) {
    +        None
    +      } else {
    +        val in = new FsInput(path, conf)
    --- End diff --
    
    Not a big deal but we can use `Utils.tryiWithResource`


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to