-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Added description to python spark Pi example #19632
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
examples/src/main/python/pi.py
Outdated
| .getOrCreate() | ||
|
|
||
|
|
||
| # If no arguments are passed(i.e. `len(sys.argv) < = 1` ) |
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.
This isn't visible to end users, so don't know if this matters. It's already documented in the usage. I am not sure this meaningfully helps.
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.
So I think we should expect folks to read the examples in addition to running them. That being said I don't think we need this comment specifically.
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.
This is actually the first example on the spark doc and I wanted to know how the pi calculation was done. There was no mention of what algorithm is used for it, so took me a while to figure out the Monte-Carlo estimator was used and the logic is randomly generating over 100000 points to finally estimate the Pi value.
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.
|
Thanks for helping out with the Spark project, it's great to see folks looking to improve the examples :) I'm not sure the in-line comment adds much, but the docstring one looks like a good minor improvement :) |
|
Test build #3975 has finished for PR 19632 at commit
|
PEP8
Description added for SparkPi example
srowen
left a comment
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.
Sorry, this still has several problems and doesn't add much. Close it please
| """ | ||
| Usage: pi [partitions] | ||
| Monte Carlo method is used to estimate Pi in the below example. |
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.
below example -> example below
| .appName("PythonPi")\ | ||
| .getOrCreate() | ||
|
|
||
| # If no arguments are passed(i.e. `len(sys.argv) < = 1` ) |
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.
Missing space after passed, problem in "< ="
This comment just restates the code below.
What changes were proposed in this pull request?
Description added to better understand example.
How was this patch tested?
Not required as only comments are required.
Please review http://spark.apache.org/contributing.html before opening a pull request.