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

   Note: this PR was auto-generated by tooling. Before moving it out of draft, 
the author has done a full review of the PR, specifically evaluating it on the 
following criteria:
   
   - The PR is an appropriate fix for the issue (e.g. we're not changing a test 
to avoid a bug)
   - The PR is a simple fix to the issue (e.g. we're not adding infra when we 
could just modify a test)
   - The PR is not covering for other problems (e.g. if we're bumping timeouts, 
it is not because we're covering for a performance problem)
     
   Full details of the methodology of generation and review can be found here - 
https://docs.google.com/document/d/14lj7ECVov4T4EdwmIzNlWrRGE3lLDMOwX5xUMGzaLoc/edit?usp=sharing
   
   If you have concerns with the PR or with the underlying methodology used to 
generate this, please comment below - they will be addressed by the author not 
the tooling :)
   
   ## Summary
   
   Passes `reshuffle=False` to `beam.Create(mutation_group, reshuffle=False)` 
in `SpannerWriteTest`'s bundle-scoped `_BatchFn` batching unit tests 
(`test_batch_byte_size`, `test_batch_max_rows`, and `test_batch_max_cells`) in 
`sdks/python/apache_beam/io/gcp/experimental/spannerio_test.py`.
   
   ## Root Cause
   
   `_BatchFn` buffers elements per bundle and flushes any remaining buffered 
mutations in `finish_bundle()`. `test_batch_byte_size`, `test_batch_max_rows`, 
and `test_batch_max_cells` created 50 mutation groups via 
`beam.Create(mutation_group)` with the default `reshuffle=True`, which inserts 
a `Reshuffle()` fusion break before `_BatchFn`. On `PrismRunner` (the default 
`TestPipeline()` runner), that reshuffle can split the 50 elements across 
multiple bundles, causing `finish_bundle()` to flush partial batches (e.g., 
`[25, 24, 1]` instead of `[25, 25]` and `[5, 5, 5, 5, 5, 5, 5, 2, 5, 5, 3]` 
instead of `[5] * 10`).
   
   ## Fix
   
   - Pass `reshuffle=False` to `beam.Create(mutation_group, reshuffle=False)` 
in `test_batch_byte_size`, `test_batch_max_rows`, and `test_batch_max_cells` so 
`Impulse() | FlatMap | Map | ParDo(_BatchFn)` stays fused in a single 
deterministic bundle.
   
   ## Verification
   
   - Verified formatting with `yapf --style setup.cfg --diff` (clean).
   - Ran `pytest apache_beam/io/gcp/experimental/spannerio_test.py -v` locally 
against PrismRunner (15/15 passed).
   
   ### Recent Occurrences
   
   1 failing `master` workflow run in the past 3 weeks:
   - `PreCommit Python` (3.14):
     - https://github.com/apache/beam/actions/runs/45284290796 (2026-11-23)
   
   ### Verification
   - Triggered `beam_PreCommit_Python.yml` workflow run on branch: 
[`45446133570`](https://github.com/apache/beam/actions/runs/45446133570)
   


-- 
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]

Reply via email to