itholic commented on code in PR #42798:
URL: https://github.com/apache/spark/pull/42798#discussion_r1315352479
##########
python/pyspark/pandas/groupby.py:
##########
@@ -3534,7 +3534,12 @@ def _reduce_for_stat_function(
for label in psdf._internal.column_labels:
psser = psdf._psser_for(label)
input_scol = psser._dtype_op.nan_to_null(psser).spark.column
- output_scol = sfun(input_scol)
+ if sfun.__name__ == "sum" and isinstance(
+ psdf._internal.spark_type_for(label), StringType
+ ):
+ output_scol = F.concat_ws("", F.collect_list(input_scol))
Review Comment:
I think maybe this is different case from `head`?
In head, we do `sdf = sdf.orderBy(NATURAL_ORDER_COLUMN_NAME)` and compute
the `sdf.limit(n)`, so that we can keep the order because `DataFrame.limit`
doesn't shuffle the data.
But in this case, it shuffles the data again when computing the
`collect_list` even after sorting the DataFrame by natural order in advance, so
I think the order would not be guaranteed.
Please let me know if I missed something??
--
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]