[SPARK-44887][DOCS] Fix wildcard import from pyspark.sql.functions import * in Quick Start Examples#42579
Closed
zhengruifeng wants to merge 1 commit intoapache:masterfrom
Closed
Conversation
Contributor
Author
|
there are two wildcard import under As to the |
Contributor
Author
HyukjinKwon
approved these changes
Aug 21, 2023
LuciferYang
approved these changes
Aug 21, 2023
Member
|
Merged to master. |
Contributor
|
Thanks for the fix! Shall we also merge it and all other docstring fixes and improvements to Spark 3.5? |
Member
|
let's don't. improvements shouldn't go to other branches by right, and the 3.5 release is being soon. |
valentinp17
pushed a commit
to valentinp17/spark
that referenced
this pull request
Aug 24, 2023
…mport *` in `Quick Start` Examples ### What changes were proposed in this pull request? Fix wildcard import `from pyspark.sql.functions import *` in https://spark.apache.org/docs/latest/quick-start.html ### Why are the changes needed? to follow the [PEP 8 - Style Guide for Python Code](https://peps.python.org/pep-0008/) > Wildcard imports (from <module> import *) should be avoided, as they make it unclear which names are present in the namespace, confusing both readers and many automated tools. There is one defensible use case for a wildcard import, which is to republish an internal interface as part of a public API (for example, overwriting a pure Python implementation of an interface with the definitions from an optional accelerator module and exactly which definitions will be overwritten isn’t known in advance). When republishing names this way, the guidelines below regarding public and internal interfaces still apply. to avoid potential namespace conflicts, since there are several sql functions already shared the same names with built-in modules/functions (e.g. `min`/`max`/`sum`/`hash`) ### Does this PR introduce _any_ user-facing change? yes ### How was this patch tested? CI ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#42579 from zhengruifeng/docs_avoid_wildcard_imports. Authored-by: Ruifeng Zheng <ruifengz@apache.org> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Fix wildcard import
from pyspark.sql.functions import *in https://spark.apache.org/docs/latest/quick-start.htmlWhy are the changes needed?
to follow the PEP 8 - Style Guide for Python Code
to avoid potential namespace conflicts, since there are several sql functions already shared the same names with built-in modules/functions (e.g.
min/max/sum/hash)Does this PR introduce any user-facing change?
yes
How was this patch tested?
CI
Was this patch authored or co-authored using generative AI tooling?
No