[SPARK-58008][SQL] Support dynamic table options for DELETE#57161
Open
brijrajk wants to merge 1 commit into
Open
[SPARK-58008][SQL] Support dynamic table options for DELETE#57161brijrajk wants to merge 1 commit into
brijrajk wants to merge 1 commit into
Conversation
Extends the per-statement WITH (key=value) options clause to DELETE, consistent with SELECT (SPARK-36680), INSERT (SPARK-49098), and UPDATE (SPARK-57681). Changes: - Grammar: add optionsClause? to the deleteFromTable rule - AstBuilder: pass Option(ctx.optionsClause()) to createUnresolvedRelation - RewriteDeleteFromTable: use r.options instead of CaseInsensitiveStringMap.empty() - DDLParserSuite: two parser tests for DELETE WITH options (with and without alias) - DeleteFromTableSuiteBase: end-to-end tests verifying options reach the row-level operation; use salary < 200 (LessThan) rather than pk = 1 (EqualTo) to prevent OptimizeMetadataOnlyDeleteFromTable from replacing the row-level plan with a filter-only deleteWhere call Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
947040a to
212020e
Compare
Member
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?
Extends the per-statement
WITH (key = value)options clause toDELETEstatements, consistent with the support already present forSELECT(SPARK-36680),INSERT(SPARK-49098), andUPDATE(SPARK-57681).Example syntax:
The options are forwarded through the
DataSourceV2Relation,RowLevelOperationInfo, andLogicalWriteInfoso that DataSource V2 connectors receive them at every layer of the write path.Why are the changes needed?
DELETEwas the only DML statement missing this capability. Adding it completes the feature set across all row-level write operations and allows connectors to accept per-statement tuning options (e.g. split size, isolation level) on deletes without requiring separate configuration.Does this PR introduce any user-facing change?
Yes — new SQL syntax.
DELETE FROM tbl WITH (k = v) WHERE ...is now valid.How was this patch tested?
DDLParserSuite: two new parser tests coveringDELETE ... WITH (...)without and with an alias.DeleteFromTableSuiteBase: two new end-to-end tests verifying that options reach theDataSourceV2Relation,RowLevelOperationInfo, andLogicalWriteInfolayers.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Sonnet 4.6