[SPARK-51834][SQL][FOLLOW-UP] Add missing .withConstraints() in AtomicReplaceTableExec#54322
Open
yyanyy wants to merge 1 commit intoapache:masterfrom
Open
[SPARK-51834][SQL][FOLLOW-UP] Add missing .withConstraints() in AtomicReplaceTableExec#54322yyanyy wants to merge 1 commit intoapache:masterfrom
.withConstraints() in AtomicReplaceTableExec#54322yyanyy wants to merge 1 commit intoapache:masterfrom
Conversation
…omicReplaceTableExec` SPARK-51834 added `.withConstraints()` to `CreateTableExec` and `ReplaceTableExec` but missed `AtomicReplaceTableExec` in the same file. This causes `REPLACE TABLE` and `CREATE OR REPLACE TABLE` with constraints to silently drop them when the catalog implements `StagingTableCatalog`. Also fixes `StagingInMemoryTableCatalog` to forward constraints when constructing `InMemoryTable`, and adds regression tests for all four constraint types through the atomic replace path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
SPARK-51834 added
.withConstraints()toCreateTableExecandReplaceTableExecbut missedAtomicReplaceTableExecin the same file. This causesREPLACE TABLEandCREATE OR REPLACE TABLEwith constraints to silently drop them when the catalog implementsStagingTableCatalog.Also fixes
StagingInMemoryTableCatalogto forward constraints when constructingInMemoryTable, and adds regression tests for all four constraint types through the atomic replace path.Why are the changes needed?
AtomicReplaceTableExecdoes not call.withConstraints()when buildingTableInfo, soREPLACE TABLEandCREATE OR REPLACE TABLEsilently drop constraints when the catalog implementsStagingTableCatalog.Does this PR introduce any user-facing change?
Yes. Previously, REPLACE TABLE and CREATE OR REPLACE TABLE with constraints would silently drop constraints when using a
StagingTableCatalog. After this fix, constraints are correctly passed through to the catalog.How was this patch tested?
New unit tests in
UniqueConstraintSuite,PrimaryKeyConstraintSuite,CheckConstraintSuite, andForeignKeyConstraintSuitethat exerciseREPLACE TABLEwith constraints through the atomic catalog path (StagingInMemoryTableCatalog). Verified that all 4 new tests fail without the fix and pass with it. All existing tests in these suites continue to pass.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 4.6 noreply@anthropic.com