[VL] Honor BatchWrite.useCommitCoordinator in columnar V2 writes#12562
Draft
malinjawi wants to merge 2 commits into
Draft
[VL] Honor BatchWrite.useCommitCoordinator in columnar V2 writes#12562malinjawi wants to merge 2 commits into
malinjawi wants to merge 2 commits into
Conversation
|
Run Gluten Clickhouse CI on x86 |
The columnar V2 write path committed every task attempt unconditionally, ignoring BatchWrite.useCommitCoordinator. With speculative execution or a retried stage, two attempts of the same partition could both call DataWriter.commit(), producing duplicate output that vanilla Spark prevents. This change mirrors vanilla Spark's DataWritingSparkTask semantics: - Thread useCommitCoordinator from BatchWrite into WritingColumnarBatchSparkTask.run and, when enabled, gate DataWriter.commit() behind OutputCommitCoordinator.canCommit, throwing QueryExecutionErrors.commitDeniedError on denial so the denied attempt aborts instead of committing. - Track whether the writer already committed and skip DataWriter.abort() in the failure callback after a successful commit, so a post-commit failure (e.g. while reporting metrics) cannot roll back durable output. - Accumulate the per-task row count as Long to avoid Int overflow for partitions with more than Int.MaxValue rows. Adds ColumnarDataWritingSparkTaskSuite covering commit-denied abort, post-commit failure not aborting, pre-commit failure aborting, Long row counting, and the useCommitCoordinator=false path.
malinjawi
force-pushed
the
fix/v2-write-commit-coordinator
branch
from
July 19, 2026 11:17
c951222 to
15f4623
Compare
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
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 are proposed in this pull request?
The columnar V2 write path commits every task attempt unconditionally — it ignores
BatchWrite.useCommitCoordinator. With speculative execution or a retried stage, two attempts of the same partition can both callDataWriter.commit()and produce duplicate output.This brings
WritingColumnarBatchSparkTaskin line with vanilla Spark'sDataWritingSparkTask:useCommitCoordinatorfrom theBatchWriteinto the task, and gatecommit()behindOutputCommitCoordinator.canCommit, throwing the standard commit-denied error when the attempt loses.abort()once a commit has succeeded. This path updates native write metrics after commit, and a failure there was aborting already-durable output. (Vanilla has no post-commit code that can throw, so it doesn't need this guard; we do.)Longinstead ofIntto avoid overflow on large partitions.How was this patch tested?
New
ColumnarDataWritingSparkTaskSuitedrives the task with a recording writer factory and a stub commit coordinator: a denied attempt throws and aborts+closes the writer, a failure after commit does not abort, a failure before commit does, row counts accumulate pastInt.MaxValue, and the coordinator-off path is unchanged.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (reviewed and tested before submission)