amaliujia commented on code in PR #38793: URL: https://github.com/apache/spark/pull/38793#discussion_r1034305923
########## connector/connect/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala: ########## @@ -242,6 +243,17 @@ class SparkConnectPlanner(session: SparkSession) { .logicalPlan } + private def transformWithColumns(rel: proto.WithColumns): LogicalPlan = { + val (names, cols) = + rel.getNameExprListList.asScala + .map(e => (e.getName(0), Column(transformExpression(e.getExpr)))) Review Comment: The current API design is not good because it carries ambiguity thus it asks server to validate. This happens because we put two things on the same proto field then server side needs to either if else or validate one case. This is the primary point. The current way for error handling only makes it looks even terrible. ########## connector/connect/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala: ########## @@ -242,6 +243,17 @@ class SparkConnectPlanner(session: SparkSession) { .logicalPlan } + private def transformWithColumns(rel: proto.WithColumns): LogicalPlan = { + val (names, cols) = + rel.getNameExprListList.asScala + .map(e => (e.getName(0), Column(transformExpression(e.getExpr)))) Review Comment: The current API design is not good because it carries ambiguity thus it asks server to validate. This happens because we put two things on the same proto field then server side needs to either if else or validate one case. This is the primary point. The current way for error handling only makes it looks even more terrible. -- 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