zhengruifeng commented on code in PR #38829:
URL: https://github.com/apache/spark/pull/38829#discussion_r1034318046


##########
python/pyspark/sql/connect/dataframe.py:
##########
@@ -1068,6 +1068,23 @@ def inputFiles(self) -> List[str]:
         query = self._plan.to_proto(self._session.client)
         return self._session.client._analyze(query).input_files
 
+    def toDF(self, *cols: str) -> "DataFrame":
+        """Returns a new :class:`DataFrame` that with new specified column 
names
+
+        Parameters
+        ----------
+        *cols : tuple
+            a tuple of string new column name or :class:`Column`. The length 
of the
+            list needs to be the same as the number of columns in the initial
+            :class:`DataFrame`
+
+        Returns
+        -------
+        :class:`DataFrame`
+            DataFrame with new column names.
+        """
+        return DataFrame.withPlan(plan.RenameColumns(self._plan, list(cols)), 
self.sparkSession)

Review Comment:
   ```suggestion
           return DataFrame.withPlan(plan.RenameColumns(self._plan, 
list(cols)), self._session)
   ```



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