davidm-db commented on code in PR #53530:
URL: https://github.com/apache/spark/pull/53530#discussion_r2703996580


##########
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingExecutionContext.scala:
##########
@@ -53,6 +55,108 @@ class SqlScriptingExecutionContext extends 
SqlScriptingExecutionContextExtension
   def currentFrame: SqlScriptingExecutionFrame = frames.last
   def currentScope: SqlScriptingExecutionScope = currentFrame.currentScope
 
+  /**
+   * Find a cursor by its normalized name in the current scope and parent 
scopes.
+   * Implementation of SqlScriptingExecutionContextExtension API.
+   *
+   * Searches current frame first (respects shadowing), then script frame (for 
cross-frame access).
+   * This ensures cursors declared in handlers shadow cursors with the same 
name in the script.
+   */
+  override def findCursorByName(normalizedName: String): 
Option[CursorDefinition] = {

Review Comment:
   I might be misunderstanding something here... What does the term "namespace" 
mean here?
   
   Per your code, you want to be able to resolve cursors using labels - i.e. 
have the scoping mechanism work for cursors. To me this looked like CURSOR is a 
type - a very specific type though, similar to how TABLEREF would be.
   
   Can you explain what the namespace means and how it affects cursors and 
makes them different compared to other types that could be used for variables? 



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