-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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
[SPARK-3985] [Examples] fix file path using os.path.join #2834
Conversation
Test FAILed. |
retest this please. |
QA tests have started for PR 2834 at commit
|
QA tests have finished for PR 2834 at commit
|
Test PASSed. |
@@ -48,7 +48,7 @@ | |||
|
|||
# A JSON dataset is pointed to by path. | |||
# The path can be either a single text file or a directory storing text files. | |||
path = os.environ['SPARK_HOME'] + "examples/src/main/resources/people.json" | |||
path = os.path.join(os.environ['SPARK_HOME'], "examples/src/main/resources/people.json") |
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.
Is it maybe simpler to just add a / ? This makes it look like the path is platform independent but it isn't as the following path always has /
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 was just trying to make this consistent with other code in python/pyspark/**.py. It is OK if you believe add a '/' is better.
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.
Consistency is good too. Leave it unless someone else thinks it should change.
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 think the os.path.join
is fine; I think it's more clear / less brittle. If it turns out that we do need to make changes to the path separator in order to support Windows, then using os.path.join
makes it easier to spot where path construction is taking place in order to find the code that needs to be changed.
LGTM. Thanks for catching this! |
No description provided.