spark icon indicating copy to clipboard operation
spark copied to clipboard

[SQL][MINOR] Forbid duplicate SQLEXCEPTION and NOT FOUND handlers inside SQL Script

Open miland-db opened this issue 6 months ago • 3 comments

What changes were proposed in this pull request?

In this PR we forbid duplicate SQLEXCEPTION or NOT FOUND exception handlers to be defined in the same scope. This was already done for different conditions and sqlstates but was not done for these 2 types of exception handlers. Code like this should fail:

BEGIN
  DECLARE EXIT HANDLER FOR NOT FOUND
  BEGIN
    SELECT 1;
  END;
  DECLARE EXIT HANDLER FOR NOT FOUND
  BEGIN
    SELECT 2;
  END;
END

Why are the changes needed?

This is a bug fix.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

New tests in SqlScriptingInterpreterSuite.

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

No.

miland-db avatar Jun 12 '25 11:06 miland-db

Adding @cloud-fan , @davidm-db, @MaxGekk

miland-db avatar Jun 12 '25 12:06 miland-db

SqlScriptingInterpreterSuite fails

cloud-fan avatar Jun 13 '25 04:06 cloud-fan

Let's create a JIRA ticket. This is not a minor change. Otherwise LGTM

cloud-fan avatar Jun 16 '25 02:06 cloud-fan

Hey @cloud-fan, I created a JIRA ticket. Thanks for the review!

miland-db avatar Jun 16 '25 12:06 miland-db

thanks, merging to master/4.0!

cloud-fan avatar Jun 19 '25 01:06 cloud-fan