[SPARK-56561][DOCS] Document order preservation for array_distinct, array_intersect, array_union, array_except#55549
Open
shrirangmhalgi wants to merge 1 commit intoapache:masterfrom
Conversation
8e03f20 to
534cf1b
Compare
…rray_intersect, array_union, array_except
534cf1b to
0b421b0
Compare
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?
This change documents the order preservation behavior of
array_distinct,array_intersect,array_union, andarray_exceptin:@ExpressionDescription)functions.scala)builtin.py)Also fixes an incorrect statement in
array_except's scaladoc which said "The order of elements in the result is not determined" - the implementation preserves order from the first array.Why are the changes needed?
With this change users will not have to read implementation code to know whether these functions preserve element order. This is useful for code reviews and helps AI coding agents understand the behavior.
Does this PR introduce any user-facing change?
No - It is just updating the documentation.
How was this patch tested?
CollectionExpressionsSuiteandDataFrameFunctionsSuitebuild/sbt 'catalyst/testOnly *CollectionExpressionsSuite -- -z "Array Distinct" -z "Array Union" -z "Array Except" -z "Array Intersect"'build/sbt 'sql/testOnly *DataFrameFunctionsSuite -- -z "array_distinct" -z "array_intersect" -z "array_union" -z "array_except"'spark-shell:Result -
array_distinct([3,1,2,1,3]) = ArraySeq(3, 1, 2)Result -
array_union([3,1,2,1,3], [2,4,3]) = ArraySeq(3, 1, 2, 4)Result -
array_intersect([3,1,2,1,3], [2,4,3]) = ArraySeq(3, 2)Result -
array_except([3,1,2,1,3], [2,4,3]) = ArraySeq(1)What changes were proposed in this pull request?
Documentation update.
Was this patch authored or co-authored using generative AI tooling?
No.