zhengruifeng commented on code in PR #42798:
URL: https://github.com/apache/spark/pull/42798#discussion_r1316574489
##########
python/pyspark/pandas/groupby.py:
##########
@@ -3537,14 +3537,14 @@ def _reduce_for_stat_function(
if sfun.__name__ == "sum" and isinstance(
psdf._internal.spark_type_for(label), StringType
):
+ input_scol_name =
psser._internal.data_spark_column_names[0]
# Sort data with natural order column to ensure order of
data
- sorted_array = F.array_sort(
- F.collect_list(F.struct(NATURAL_ORDER_COLUMN_NAME,
input_scol))
+ output_scol = F.concat_ws(
+ "",
+ F.array_sort(
+ F.collect_list(F.struct(NATURAL_ORDER_COLUMN_NAME,
input_scol))
+ ).getField(input_scol_name),
Review Comment:
I think you will need `F.transform` to extract the strings.
Other wise, you can use `F.reduce` to directly concate the strings from
structs [<long, string>]
--
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]