Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

adrian-wang
Copy link
Contributor

No description provided.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/21835/
Test FAILed.

@adrian-wang
Copy link
Contributor Author

retest this please.

@SparkQA
Copy link

SparkQA commented Oct 17, 2014

QA tests have started for PR 2834 at commit da7aa95.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Oct 17, 2014

QA tests have finished for PR 2834 at commit da7aa95.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/21838/
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")
Copy link
Member

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 /

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor

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.

@JoshRosen
Copy link
Contributor

LGTM. Thanks for catching this!

@asfgit asfgit closed this in 23f6171 Oct 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants