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

   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
   
   Fixes flaky `PostCommit SQL` timeouts (`Did not receive signal ... in 600s`) 
in `PubsubTableProviderIT.testSQLSelectsArrayAttributes` by passing 
`queryOutput.getCoder()` instead of `SchemaCoder.of(PAYLOAD_SCHEMA)` to 
`resultSignal.signalSuccessWhen(...)`.
   
   ## Root Cause
   
   In 
`sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/meta/provider/pubsub/PubsubTableProviderIT.java`:
   - `testSQLSelectsArrayAttributes` runs the 3-column query:
     ```sql
     SELECT message.payload.id, attributes[1].key AS a1, attributes[2].key AS 
a2 FROM message
     ```
     producing `Row`s with **3 fields** (`id`, `a1`, `a2`).
   - Line 236 passed `SchemaCoder.of(PAYLOAD_SCHEMA)` (**2 fields**: `id`, 
`name`) as the `BagState<Row>` coder to `resultSignal.signalSuccessWhen(...)`.
   - When all 3 Pub/Sub messages arrive in a single DirectRunner bundle, 
`InMemoryStateInternals.InMemoryBag` stores the rows in memory without invoking 
the coder and the test passes.
   - Whenever Pub/Sub delivers the 3 messages across 2+ bundles, 
`CopyOnAccessInMemoryStateInternals.bindBag()` calls `InMemoryBag.copy()` → 
`uncheckedClone(SchemaCoder.of(PAYLOAD_SCHEMA), row)` → 
`RowCoderGenerator.EncodeInstruction.encodeDelegate()`, which throws 
`IllegalStateException` at `checkState(encodingPosToIndex.length == 
value.getFieldCount())` (`2 != 3`) outside `StatefulPredicateCheck`'s 
`try`/`catch`. Because `integrationTest` runs DirectRunner with 
`--blockOnRun=false`, the pipeline dies silently in the background while 
`resultSignal.waitForSuccess(600s)` hangs for 10 minutes (in all 3 recent 
failures, JUnit stderr logged only 1–2 entries from bundle 1 and nothing 
afterwards).
   
   ## Fix
   
   - Pass `queryOutput.getCoder()` to `resultSignal.signalSuccessWhen(...)` in 
`PubsubTableProviderIT.testSQLSelectsArrayAttributes` (matching `PubsubReadIT` 
and `FhirIOReadIT`).
   
   ### Recent Occurrences
   
   3 failing `master` workflow runs in the past 3 weeks (3 of 3 failures in the 
last 50 runs of `PostCommit SQL`):
   - https://github.com/apache/beam/actions/runs/45665597803 (2026-11-25, 
`testSQLSelectsArrayAttributes[1]`, logged only `Entries: {5=bar}`)
   - https://github.com/apache/beam/actions/runs/44515510739 (2026-11-19, 
`testSQLSelectsArrayAttributes[2]`, logged only `Entries: {5=bar, 7=baz}`)
   - https://github.com/apache/beam/actions/runs/44244795433 (2026-11-18, 
`testSQLSelectsArrayAttributes[2]`, logged only `Entries: {7=baz}`)
   
   ### Verification
   - Triggered `beam_PostCommit_SQL.yml` workflow run on branch: 
[`45690347672`](https://github.com/apache/beam/actions/runs/45690347672)
   


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