You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "zhengruifeng (via GitHub)" <gi...@apache.org> on 2023/09/18 03:15:09 UTC

[GitHub] [spark] zhengruifeng commented on a diff in pull request #42968: [SPARK-45113][FOLLOWUP] Fix test failed in Scala 2.13

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-unsubscribe@spark.apache.org

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


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