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


##########
python/pyspark/sql/connect/dataframe.py:
##########
@@ -211,14 +212,66 @@ def filter(self, condition: Expression) -> "DataFrame":
             plan.Filter(child=self._plan, filter=condition), 
session=self._session
         )
 
-    def first(self) -> Optional["pandas.DataFrame"]:
-        return self.head(1)
+    def first(self) -> Optional[Row]:
+        """Returns the first row as a :class:`Row`.
+
+        .. versionadded:: 3.4.0
+
+        Returns
+        -------
+        :class:`Row`
+           First row if :class:`DataFrame` is not empty, otherwise ``None``.
+        """
+        return self.head()

Review Comment:
   This is implementation details though but updated to `self.head(1)`.



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