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

    https://github.com/apache/spark/pull/3628#discussion_r21412176
  
    --- Diff: 
examples/src/main/scala/org/apache/spark/examples/sql/hive/HiveFromSpark.scala 
---
    @@ -24,10 +28,16 @@ import org.apache.spark.sql.hive.HiveContext
     object HiveFromSpark {
       case class Record(key: Int, value: String)
     
    +  // Copy kv1.txt file from classpath to temporary directory
    +  val kv1Stream = HiveFromSpark.getClass.getResourceAsStream("/kv1.txt")
    +  val tmpDir = Files.createTempDir()
    +  tmpDir.deleteOnExit()
    --- End diff --
    
    I don't think this works for non-empty directories. You'd need to 
recursively delete it. Instead of creating a temp directory, I'd just use 
`File.createTempFile()`, unless the name of the file reeeeeally needs to be 
`kv1.txt`.
    
    Also, the paranoid in me would close all open streams in a finally block, 
but not super important in this code.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to