You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/12/05 05:30:27 UTC

[GitHub] [spark] amaliujia commented on a diff in pull request #38908: [SPARK-41384][CONNECT] Should use SQLExpression for str arguments in Projection

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


##########
python/pyspark/sql/connect/dataframe.py:
##########
@@ -137,7 +137,13 @@ def isEmpty(self) -> bool:
         return len(self.take(1)) == 0
 
     def select(self, *cols: "ColumnOrName") -> "DataFrame":
-        return DataFrame.withPlan(plan.Project(self._plan, *cols), session=self._session)
+        sql_expr = []
+        for element in cols:
+            if isinstance(element, str):
+                sql_expr.append(sql_expression(element))

Review Comment:
   This is something I am not sure for Python (PySpark):
   
   `spark.range(10).groupBy("id").sum("id").select("sum(id)")` this works in PySpark.



-- 
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-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org