-
Notifications
You must be signed in to change notification settings - Fork 28.7k
[SPARK-4774] [SQL] Makes HiveFromSpark more portable #3628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
// Copy kv1.txt file from classpath to temporary directory | ||
val kv1Stream = HiveFromSpark.getClass.getResourceAsStream("/kv1.txt") | ||
val tmpDir = Files.createTempDir() | ||
tmpDir.deleteOnExit() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Looks ok aside from the cleanup issue. |
Test build #24201 has started for PR 3628 at commit
|
Thanks for doing this! Mind adding |
HiveFromSpark read the kv1.txt file from SPARK_HOME/examples/src/main/resources/kv1.txt which assumed you had a source tree checked out. Now we copy the kv1.txt file to a temporary file and delete it when the jvm shutsdown. This allows us to run this example outside of a spark source tree.
fca97ee
to
6770f83
Compare
Test build #24202 has started for PR 3628 at commit
|
Test build #24201 has finished for PR 3628 at commit
|
Test PASSed. |
Test build #24202 has finished for PR 3628 at commit
|
Test PASSed. |
LGTM |
HiveFromSpark read the kv1.txt file from SPARK_HOME/examples/src/main/resources/kv1.txt which assumed you had a source tree checked out. Now we copy the kv1.txt file to a temporary file and delete it when the jvm shuts down. This allows us to run this example outside of a spark source tree. Author: Kostas Sakellis <[email protected]> Closes #3628 from ksakellis/kostas-spark-4774 and squashes the following commits: 6770f83 [Kostas Sakellis] [SPARK-4774] [SQL] Makes HiveFromSpark more portable (cherry picked from commit d6a972b) Signed-off-by: Michael Armbrust <[email protected]>
HiveFromSpark read the kv1.txt file from SPARK_HOME/examples/src/main/resources/kv1.txt which assumed
you had a source tree checked out. Now we copy the kv1.txt file to a temporary file and delete it when
the jvm shuts down. This allows us to run this example outside of a spark source tree.