srielau commented on code in PR #53530:
URL: https://github.com/apache/spark/pull/53530#discussion_r2699428865
##########
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:
Actually it does work. We have tests where we close the cursor inside the
exit handler.
The tests are only one level, instead of two, but that gives me confidence...
--
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]