brijrajk opened a new pull request, #56250: URL: https://github.com/apache/spark/pull/56250
### What changes were proposed in this pull request? Added explicit order-preservation notes to the docstrings of four array set functions in PySpark: `array_distinct`, `array_intersect`, `array_union`, and `array_except`. Previously the docstrings were silent on whether input order is preserved, leaving users to guess or test empirically. The additions are: - `array_distinct`: *preserving the order of first occurrence* - `array_intersect`: *preserving the order of elements from col1* - `array_union`: *preserving the order from col1 followed by elements in col2 not in col1* - `array_except`: *preserving the order of elements from col1* ### Why are the changes needed? Order-preservation is a useful guarantee for users composing these functions in pipelines — e.g. knowing that `array_distinct` keeps the first occurrence means there is no need to sort afterwards to get a stable result. This is useful to cite in code reviews and helps inform AI coding assistants as noted in SPARK-56561. Fixes https://issues.apache.org/jira/browse/SPARK-56561 ### Does this PR introduce _any_ user-facing change? No. Documentation (docstring) only — no logic changes. ### How was this patch tested? No logic change. Confirmed order-preservation behavior by reading the `ArraySetLike` trait and `ArrayDistinct`, `ArrayIntersect`, `ArrayUnion`, and `ArrayExcept` implementations in `collectionOperations.scala`. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude (Anthropic) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
