cloud-fan commented on code in PR #52987:
URL: https://github.com/apache/spark/pull/52987#discussion_r2525679254


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -6577,16 +6577,22 @@ class AstBuilder extends DataTypeAstBuilder
 
   private def visitOperatorPipeRightSide(
       ctx: OperatorPipeRightSideContext, left: LogicalPlan): LogicalPlan = {
-    if (!SQLConf.get.getConf(SQLConf.OPERATOR_PIPE_SYNTAX_ENABLED)) {
+    if (!conf.getConf(SQLConf.OPERATOR_PIPE_SYNTAX_ENABLED)) {
       operationNotAllowed("Operator pipe SQL syntax using |>", ctx)
     }
     Option(ctx.selectClause).map { c =>
+      // Check if GROUP BY is used with pipe SELECT when the config is disabled
+      if (ctx.aggregationClause != null && 
!conf.pipeOperatorAllowAggregateInSelect) {
+        operationNotAllowed(
+          "|> SELECT with a GROUP BY clause is not allowed when " +
+          "spark.sql.allowAggregateInSelectWithPipeOperator is disabled", ctx)

Review Comment:
   This makes me wondering why we need the config. If people don't agg function 
in pipe SELECT, then they just don't use it. If they use it, then they will see 
this error message and enable this config immediately.
   
   cc @srielau 



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -6577,16 +6577,22 @@ class AstBuilder extends DataTypeAstBuilder
 
   private def visitOperatorPipeRightSide(
       ctx: OperatorPipeRightSideContext, left: LogicalPlan): LogicalPlan = {
-    if (!SQLConf.get.getConf(SQLConf.OPERATOR_PIPE_SYNTAX_ENABLED)) {
+    if (!conf.getConf(SQLConf.OPERATOR_PIPE_SYNTAX_ENABLED)) {
       operationNotAllowed("Operator pipe SQL syntax using |>", ctx)
     }
     Option(ctx.selectClause).map { c =>
+      // Check if GROUP BY is used with pipe SELECT when the config is disabled
+      if (ctx.aggregationClause != null && 
!conf.pipeOperatorAllowAggregateInSelect) {
+        operationNotAllowed(
+          "|> SELECT with a GROUP BY clause is not allowed when " +
+          "spark.sql.allowAggregateInSelectWithPipeOperator is disabled", ctx)

Review Comment:
   This makes me wondering why we need the config. If people don't use agg 
function in pipe SELECT, then they just don't use it. If they use it, then they 
will see this error message and enable this config immediately.
   
   cc @srielau 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to