Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -955,9 +955,10 @@ the actual processing logic. You don't need to manually extract the elements
from the input collection; the Beam SDKs handle that for you. Your `process` method
should accept an argument `element`, which is the input element, and return an
iterable with its output values. You can accomplish this by emitting individual
elements with `yield` statements. You can also use a `return` statement
with an iterable, like a list or a generator. Don't mix `yield` and
`return` statements in the same `process` method - this leads to [undefined behavior](https://github.com/apache/beam/issues/22969).
elements with `yield` statements, and use `yield from` to emit all elements from
an iterable, such as a list or a generator. Using `return` statement
with an iterable is also acceptable as long as you don't mix `yield` and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yield could cause the this error cannot pickle 'generator' object for some cases. This is why I did not update the doc in #25743

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed offline cannot pickle 'generator' object was happening in different contexts (outside of process methods). LMK if you think we should merge this, feel free to suggest a different wording.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks.

`return` statements in the same `process` method, since that leads to [incorrect behavior](https://github.com/apache/beam/issues/22969).
{{< /paragraph >}}

{{< paragraph class="language-go">}}
Expand Down