miland-db opened a new pull request, #48795:
URL: https://github.com/apache/spark/pull/48795

   ### What changes were proposed in this pull request?
   We are introducing checks for unique label names.
   New rules for label names:
   - Labels can't have the same name as some of the labels in scope surrounding 
them 
   - Labels can have the same name as other labels in the same scope
   
   **Valid** code:
   ```
   BEGIN
     lbl: BEGIN
       SELECT 1;
     END;
   
     lbl: BEGIN
       SELECT 2;
     END;
   
     BEGIN
       lbl: WHILE 1=1 DO
         LEAVE lbl;
       END WHILE;
     END;
   END
   ```
   
   **Invalid** code:
   ```
   BEGIN
     lbl: BEGIN
       lbl: BEGIN
         SELECT 1;
       END;
     END;
   END
   ```
   
   ### Why are the changes needed?
   It will be needed in future when we release Local Scoped Variables for SQL 
Scripting so users can target variables from outer scopes if they are shadowed. 
   
   ### How was this patch tested?
   New unit tests in 'SqlScriptingParserSuite.scala'.
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   No.
   


-- 
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