amaliujia commented on code in PR #38409:
URL: https://github.com/apache/spark/pull/38409#discussion_r1010931805


##########
python/pyspark/sql/connect/dataframe.py:
##########
@@ -305,8 +308,12 @@ def _print_plan(self) -> str:
             return self._plan.print()
         return ""
 
-    def collect(self) -> None:
-        raise NotImplementedError("Please use toPandas().")
+    def collect(self) -> List[Row]:
+        pdf = self.toPandas()
+        if pdf is not None:
+            return list(pdf.apply(lambda fun: Row(*fun), axis=1))

Review Comment:
   Done. I found the magic is to use `**` so that each lambda row will become 
`kwargs`. 
   
   Honestly I don't understand this magic but it is working at least.



-- 
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