dtenedor commented on code in PR #48940:
URL: https://github.com/apache/spark/pull/48940#discussion_r1859479856
##########
sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4:
##########
@@ -1520,6 +1521,15 @@ operatorPipeRightSide
| AGGREGATE namedExpressionSeq? aggregationClause?
;
+operatorPipeSetAssignmentSeq
+ : ident+=errorCapturingIdentifier
Review Comment:
Good idea, added a test case for this.
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -5978,7 +5982,59 @@ class AstBuilder extends DataTypeAstBuilder
withQueryResultClauses(c, withSubqueryAlias(), forPipeOperators = true)
}.getOrElse(
visitOperatorPipeAggregate(ctx, left)
- )))))))))
+ ))))))))))
+ }
+
+ private def visitOperatorPipeSet(
+ ctx: OperatorPipeRightSideContext, left: LogicalPlan): LogicalPlan = {
+ val (setIdentifiers: Seq[String], setTargets: Seq[Expression]) =
+ visitOperatorPipeSetAssignmentSeq(ctx.operatorPipeSetAssignmentSeq())
+ var plan = left
+ val visitedSetIdentifiers = mutable.Set.empty[String]
+ setIdentifiers.zip(setTargets).foreach {
+ case (_, _: Alias) =>
+ operationNotAllowed(
+ "SQL pipe syntax |> SET operator with an alias assigned with [AS]
aliasName", ctx)
+ case (ident, target) =>
+ // Check uniqueness of the assignment keys.
+ val checkKey = if (SQLConf.get.caseSensitiveAnalysis) {
Review Comment:
Sounds good, I added unit tests covering this feature with the config
enabled and disabled.
--
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]