Skip to content

Conversation

TeodorDjelic
Copy link
Contributor

@TeodorDjelic TeodorDjelic commented Sep 17, 2025

What changes were proposed in this pull request?

This PR implements support for interpreting and executing CONTINUE HANDLER.

Feature is under a new feature switch spark.sql.scripting.continueHandlerEnabled inside SQLConfig.scala.

Why are the changes needed?

This is a part of PRs focused on an effort to add support for CONTINUE HANDLERs. Follow-up PR will contain more tests.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Yes, an end to end test inside SqlScriptingE2eSuite.scala was added testing the CONTINUE HANDLER.

Was this patch authored or co-authored using generative AI tooling?

No.

@TeodorDjelic TeodorDjelic changed the title [SPARK-53537][Core] Adding Support for Executing CONTINUE HANDLER [SPARK-53621][Core] Adding Support for Executing CONTINUE HANDLER Sep 17, 2025
@TeodorDjelic TeodorDjelic marked this pull request as ready for review September 18, 2025 09:22
@TeodorDjelic TeodorDjelic changed the title [SPARK-53621][Core] Adding Support for Executing CONTINUE HANDLER [WIP][SPARK-53621][Core] Adding Support for Executing CONTINUE HANDLER Sep 18, 2025
@TeodorDjelic TeodorDjelic changed the title [WIP][SPARK-53621][Core] Adding Support for Executing CONTINUE HANDLER [WIP][SPARK-53621][core] Adding Support for Executing CONTINUE HANDLER Sep 18, 2025
@TeodorDjelic TeodorDjelic changed the title [WIP][SPARK-53621][core] Adding Support for Executing CONTINUE HANDLER [WIP][SPARK-53621][CORE] Adding Support for Executing CONTINUE HANDLER Sep 18, 2025
Copy link
Contributor

@dusantism-db dusantism-db left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add some tests to verify the handler works properly

Comment on lines +91 to +92
val handlerScopeLabel = if (handler.handlerType == ExceptionHandlerType.EXIT
|| handler.handlerType == ExceptionHandlerType.CONTINUE) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get this change. We either leave the if as is or we remove the condition, as these are the only 2 possible handler types.

Not sure if we need this label in a CONTINUE handler though, cc @miland-db what is this label used for again?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the label of the scope where exception handler is defined. @TeodorDjelic as you go through code feel free to add even more comments explaining what's going on.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a great place for it.

Comment on lines +209 to +213
if (handler.handlerType == ExceptionHandlerType.CONTINUE) {
SqlScriptingFrameType.CONTINUE_HANDLER
} else {
SqlScriptingFrameType.EXIT_HANDLER
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this ExceptionHandlerType.EXIT/CONTINUE and SqlScriptingFrameType.EXIT_HANDLER/CONTINUE_HANDLER is a bit confusing. We should maybe find a way to reuse information about handler type in execution frame. Let's discuss this offline first.

@github-actions github-actions bot removed the CONNECT label Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants