damccorm commented on code in PR #38429:
URL: https://github.com/apache/beam/pull/38429#discussion_r3274680482
##########
sdks/python/apache_beam/runners/common.py:
##########
@@ -1667,6 +1676,13 @@ def handle_process_outputs(
if results is None:
results = []
+ if self._check_user_dofn_output and isinstance(results, (str, bytes,
dict)):
+ object_type = type(results).__name__
+ raise TypeError(
+ 'Returning a %s from a ParDo or FlatMap is discouraged. '
Review Comment:
```suggestion
'Returning a %s from a ParDo or FlatMap is not allowed. '
```
##########
CHANGES.md:
##########
@@ -95,6 +95,7 @@
* Fixed BigQueryEnrichmentHandler batch mode dropping earlier requests when
multiple requests share the same enrichment key (Python)
([#38035](https://github.com/apache/beam/issues/38035)).
* Added `max_batch_duration_secs` passthrough support in Python Enrichment
BigQuery and CloudSQL handlers so batching duration can be forwarded to
`BatchElements` ([#38243](https://github.com/apache/beam/issues/38243)).
+* `DoFn.process` returning a `str`, `bytes`, or `dict` (instead of an iterable
wrapping one) now raises a clear `TypeError` rather than silently iterating
per-character/byte/key (Python)
([#18712](https://github.com/apache/beam/issues/18712)).
Review Comment:
This should be under the breaking changes section
--
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]