[MINOR][PYTHON][DOCS] Add example to Column.outer docstring#57199
Open
CynicDog wants to merge 2 commits into
Open
[MINOR][PYTHON][DOCS] Add example to Column.outer docstring#57199CynicDog wants to merge 2 commits into
CynicDog wants to merge 2 commits into
Conversation
Column.outer had no worked example showing how it's used to build a correlated subquery, unlike the other Column methods in this file.
uros-b
reviewed
Jul 14, 2026
| |name|salary|department_id| | ||
| +----+------+-------------+ | ||
| | Bob| 6000| 101| | ||
| +----+------+-------------+ |
Member
There was a problem hiding this comment.
Nit: the 3-row dataset puts a single employee (Charlie, 4500) in dept 102, so avg == 4500 and Charlie fails the strict > filter, leaving dept 102 with no qualifying row. The shown output is a single row (Bob), which a reader may find slightly opaque (why are two of three names absent?). Consider mirroring DataFrame.scalar() Example 2's richer dataset so both departments yield at least one qualifying row. The math is correct, this is just a readability suggestion.
uros-b
approved these changes
Jul 14, 2026
uros-b
left a comment
Member
There was a problem hiding this comment.
Left just one comment, otherwise LGTM
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?
Adds an
Examplessection toColumn.outer()'s docstring inpython/pyspark/sql/column.py. Every otherColumnmethod in this file has a worked example;outer()was the one exception.The example builds a small
employeesDataFrame and uses.outer()inside a correlated scalar subquery to filter employees earning above their department's average salary.Why are the changes needed?
outer()is easy to misunderstand from the description alone, since its effect (marking a column so it resolves against an outer query) only makes sense in the context of a correlated subquery. A concrete example makes that immediately clear, consistent with the rest of the file.Does this PR introduce any user-facing change?
No. Documentation-only change (a docstring example).
How was this patch tested?
Built Spark locally (
build/sbt -Phive package) and ran theColumn.outerdoctest directly against the built jars to confirm the example's output matches exactly.Was this patch authored or co-authored using generative AI tooling?
Yes, co-authored. The code example and documentation text were authored by me, but I used Claude as a peer-review to validate the clarity of the example and check for edge cases before submission.