apache / apache/beam

[Bug]: Python Enrichment BigQuery handler does not expose `max_batch_duration_secs` to `BatchElements`

Open
#38,243 1 comment 0 reactions 1 assignee Claimed by @prabhnoor0212 View on GitHub
bug P2 python
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

### What happened?

__Description__: In Python Enrichment, `RequestResponseIO` supports passing batching kwargs from `Caller.batch_elements_kwargs()` into `BatchElements(**kwargs)`.

`BatchElements` supports `max_batch_duration_secs`, but `BigQueryEnrichmentHandler` currently only sets:

- `min_batch_size`
- `max_batch_size`

As a result, users of `BigQueryEnrichmentHandler` cannot configure `max_batch_duration_secs`, even though the downstream batching transform supports it.

__Code path__: BigQueryEnrichmentHandler -> Enrichment -> RequestResponseIO -> BatchElements

__Current behavior__ `max_batch_duration_secs` is not available/configurable from `BigQueryEnrichmentHandler` and therefore is never forwarded to `BatchElements`.

__Expected behavior__ `BigQueryEnrichmentHandler` should optionally accept `max_batch_duration_secs` and pass it through `batch_elements_kwargs()` when batching is enabled.

__Proposed fix__

1. Add optional `max_batch_duration_secs: Optional[float] = None` to `BigQueryEnrichmentHandler.__init__`.
2. When `query_fn` is not used, include it in `_batching_kwargs` (when provided).

__Additional note__: `CloudSQLEnrichmentHandler` appears to have the same batching-kwargs limitation and may benefit from parity in a follow-up or same PR.

### Issue Priority

Priority: 2 (default / most bugs should be filed as P2)

### Issue Components

- [x] Component: Python SDK
- [ ] Component: Java SDK
- [ ] Component: Go SDK
- [ ] Component: Typescript SDK
- [ ] Component: IO connector
- [ ] Component: Beam YAML
- [ ] Component: Beam examples
- [ ] Component: Beam playground
- [ ] Component: Beam katas
- [ ] Component: Website
- [ ] Component: Infrastructure
- [ ] Component: Spark Runner
- [ ] Component: Flink Runner
- [ ] Component: Samza Runner
- [ ] Component: Twister2 Runner
- [ ] Component: Hazelcast Jet Runner
- [ ] Component: Google Cloud Dataflow Runner

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.