shikhabhadoria opened a new pull request, #41433:
URL: https://github.com/apache/beam/pull/41433
## Summary
Fixes #41348.
When `RequestResponseIO` / `Enrichment` runs with batching enabled
(`self._batching_kwargs` non-empty, e.g. `BigQueryEnrichmentHandler` or
`CloudSQLEnrichmentHandler`):
1. `inputs | BatchElements(**self._batching_kwargs)` emits each batch at
`window.max_timestamp()` (`END_OF_GLOBAL_WINDOW` =
`Timestamp(9223371950454.774999)` in `GlobalWindows`).
2. `FlattenBatch` previously yielded un-timestamped elements from the batch,
causing every enriched record to inherit `END_OF_GLOBAL_WINDOW` and breaking
downstream `WindowInto(FixedWindows(...))` and timestamp-sensitive sinks.
### Changes
- Added `_AttachWindowMetadataDoFn` and `_WindowedRequest` prior to
`BatchElements` in `RequestResponseIO.expand` to capture each element's
`(timestamp, windows, pane_info)` (while adapting `element_size_fn`,
`length_fn`, and `key_fn` in `batch_elements_kwargs` to unwrap
`_WindowedRequest`).
- Updated `_CallDoFn.process` to unwrap raw requests before invoking
`self._repeater.repeat(self._caller, ...)`, re-associate each returned response
with its corresponding request's windowing metadata (supporting both
out-of-order `(request, response)` tuples and positional responses), and emit
the batch at `min(timestamps)`.
- Updated `FlattenBatch.process` to emit
`windowed_value.WindowedValue(element.request, element.timestamp,
element.windows, element.pane_info)`, preserving exact per-element event-time
timestamps and windows.
- Added unit tests in `sdks/python/apache_beam/io/requestresponse_test.py`
and updated `CHANGES.md`.
## Checklist
- [x] If this contribution is large, please file an Apache [Individual
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
- [x] Replace these instructions with a description of your change and why
you have made it.
- [x] Mention the appropriate issue in your description (for example:
`addresses #123` or `fixes #456`).
- [x] Update `CHANGES.md` with noteworthy changes.
--
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]