zhengruifeng commented on code in PR #42968:
URL: https://github.com/apache/spark/pull/42968#discussion_r1328217212


##########
python/pyspark/sql/functions.py:
##########
@@ -3765,12 +3765,12 @@ def collect_set(col: "ColumnOrName") -> Column:
     Example 1: Collect values from a single column DataFrame
 
     >>> from pyspark.sql import functions as sf
-    >>> df = spark.createDataFrame([(2,), (5,), (5,)], ('age',))
+    >>> df = spark.createDataFrame([(5,), (5,), (5,)], ('age',))
     >>> df.select(sf.collect_set('age')).show()
     +----------------+
     |collect_set(age)|
     +----------------+
-    |          [5, 2]|
+    |             [5]|

Review Comment:
   I think it can be expected, since `collect_set/collect_list` do not 
guarantee the ordering, what about adding a `array_sort` to make it 
deterministic?



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to