cloud-fan commented on code in PR #51595:
URL: https://github.com/apache/spark/pull/51595#discussion_r2227272488
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/ParserUtils.scala:
##########
@@ -359,6 +376,39 @@ class SqlScriptingLabelContext {
seenLabels.remove(beginLabelCtx.get.multipartIdentifier().getText.toLowerCase(Locale.ROOT))
}
}
+
+ /**
+ * Enter a for loop scope.
+ * If the for loop variable is defined, it will be asserted to not be inside
seenLabels;
+ * Then, if the for loop variable is defined, it will be added to seenLabels.
+ */
+ def enterForScope(identifierCtx: Option[MultipartIdentifierContext]): Unit =
{
+ identifierCtx.foreach { ctx =>
+ val identifierName = ctx.getText
+ assertIdentifierNotInSeenLabels(identifierCtx)
+ seenLabels.add(identifierName.toLowerCase(Locale.ROOT))
+
+ if (SqlScriptingLabelContext.isForbiddenLabelName(identifierName)) {
+ withOrigin(ctx) {
+ throw SqlScriptingErrors.labelNameForbidden(
Review Comment:
so the actual error is: label name or loop variable name forbidden?
--
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]