[SPARK-58389][SQL] Pass options to catalog-backed streaming writes - #57946
Draft
yyanyy wants to merge 2 commits into
Draft
[SPARK-58389][SQL] Pass options to catalog-backed streaming writes#57946yyanyy wants to merge 2 commits into
yyanyy wants to merge 2 commits into
Conversation
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.
Note
This is a stacked follow-up to #57865, which intentionally leaves streaming unchanged.
The first commit in this draft is the current #57865 change and will disappear from the diff
after that PR merges and this branch is rebased.
What changes were proposed in this pull request?
This PR forwards user-provided options and required write privileges for catalog-backed DataSource
V2 streaming writes through
DataStreamWriter.toTable.It:
privileges:
INSERT;INSERTandDELETE;so each micro-batch re-resolution uses the same context;
DataSourceV2Relation, allowing them to flow throughV2WritesintoLogicalWriteInfo; andStreamingWrite, and transactional reloads across micro-batches.The separate
SupportsCatalogOptions.format(...).start()gap is out of scope, as are batch/readbehavior, V1-specific paths, table creation, and new continuous-transaction machinery.
Why are the changes needed?
Before this change,
DataStreamWriter.toTableloaded an existing catalog-backed V2 target withoutthe user's options or required write privileges. Transactional streaming re-resolution also used
the single-argument
loadTableAPI, dropping both values again for every micro-batch. In addition,the streaming target relation did not retain the option bag used by the command.
Catalogs that use options or
TableContextprivileges to select, construct, or authorize a writetarget therefore received incomplete information on these streaming paths.
Does this PR introduce any user-facing change?
Yes. Existing catalog-backed DataSource V2 streaming writes started with
DataStreamWriter.toTablenow pass user options and the correct output-mode privileges to targetloads and transactional reloads. The same option bag is retained for the actual V2 streaming
write. There is no API change.
How was this patch tested?
The complete affected suites were run with Java 17:
DataSourceV2OptionSuite: 37 tests passed;StreamingTransactionSuite: 9 tests passed.All 46 tests passed with no failures, exclusions, or filters.
sql/Test/compile,sql/scalastyle,and
sql/Test/scalastylealso passed.The new tests use
InMemoryBaseTablestreaming tables and independently assert the target-loadoptions/privileges, the options captured by the actual
StreamingWrite'sLogicalWriteInfo, andthe options/typed privileges observed by two transactional micro-batch reloads.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: OpenAI Codex CLI 0.145.0