vijaykarthiktk opened a new pull request, #41765:
URL: https://github.com/apache/beam/pull/41765

   Fixes #41764
   
   ### Problem
   
   `SpannerIO.write()` combined with `withWriteResults()` exposes only a
   `PCollection<WriteResults>`. When `FailureMode.REPORT_FAILURES` is 
configured,
   `WriteToSpannerFn` routes failed mutations to the failed-mutations tag, but
   `WriteWithResults` / `WriteGroupedWithResults` discard
   `SpannerWriteResult.getFailedMutations()`. The failures are neither thrown 
nor
   reachable by the caller, so they are silently lost.
   
   ### Change
   
   Fail fast with `IllegalArgumentException` when `withWriteResults()` is 
requested
   together with `FailureMode.REPORT_FAILURES`. The guard is applied at all four
   entry points so both the fluent API and direct transform construction are
   covered:
   
   - `SpannerIO.Write#withWriteResults()`
   - `SpannerIO.WriteGrouped#withWriteResults()`
   - `WriteWithResults#expand()`
   - `WriteGroupedWithResults#expand()`
   
   The message tells callers to either use `FailureMode.FAIL_FAST`, or to call
   `SpannerIO.write()` without `withWriteResults()` and read failed mutations 
from
   `SpannerWriteResult.getFailedMutations()`.
   
   ### Tests
   
   Added four regression tests to `SpannerIOWriteTest` covering both builder 
entry
   points and both `expand()` paths. Ran:
   
   ```
   ./gradlew :sdks:java:io:google-cloud-platform:spotlessApply
   ./gradlew :sdks:java:io:google-cloud-platform:checkstyleMain 
:sdks:java:io:google-cloud-platform:checkstyleTest
   GOOGLE_CLOUD_PROJECT=test-project ./gradlew 
:sdks:java:io:google-cloud-platform:test --tests '*SpannerIOWriteTest'
   ```
   
   Result: 50 tests, 50 passed.
   
   ### Checklist
   
   - [x] Description explains what changed and why
   - [x] Links the issue (`fixes #41764`)
   - [x] Unit tests added
   - [x] Formatting and checkstyle pass
   - [ ] `CHANGES.md` — not needed for a small bug fix
   - [ ] ICLA — only requested for large contributions
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

  • [PR] Reject REPORT_FAILURES wi... vijaykarthiktk (via GitHub) via github

Reply via email to