xkrogen opened a new pull request #31332:
URL: https://github.com/apache/spark/pull/31332


   ### What changes were proposed in this pull request?
   Change `AvroSuite."Ignore corrupt Avro file if flag IGNORE_CORRUPT_FILES"` 
to use `episodesAvro`, which is loaded as a resource using the classloader, 
instead of trying to read `episodes.avro` directly from a relative file path.
   
   ### Why are the changes needed?
   This is the proper way to read resource files, and currently this test will 
fail when called from my IntelliJ IDE, though it will succeed when called from 
Maven/sbt, presumably due to different working directory handling.
   
   ### Does this PR introduce _any_ user-facing change?
   No, unit test only.
   
   ### How was this patch tested?
   Previous failure from IntelliJ:
   ```
   Source 'src/test/resources/episodes.avro' does not exist
   java.io.FileNotFoundException: Source 'src/test/resources/episodes.avro' 
does not exist
        at 
org.apache.commons.io.FileUtils.checkFileRequirements(FileUtils.java:1405)
        at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1072)
        at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1040)
        at 
org.apache.spark.sql.avro.AvroSuite.$anonfun$new$34(AvroSuite.scala:397)
        at 
org.apache.spark.sql.avro.AvroSuite.$anonfun$new$34$adapted(AvroSuite.scala:388)
   ```
   Now it succeeds.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to