IIRC, Java has Flatten.iterables() and Flatten.collections(), the first of
which does what you want.

Giving FlatMap a default arg of lambda x: x is an interesting idea. The
only downside I see is a less clear error if one forgets to provide this
(now mandatory) parameter, but maybe that's low enough to be worth the
convenience?

On Thu, Mar 21, 2024 at 12:02 PM Joey Tran <[email protected]>
wrote:

> That's not really the same thing, is it? `beam.Flatten` combines two or
> more pcollections into a single pcollection while beam.FlatMap unpacks
> iterables of elements (i.e. PCollection<Iterable<T>> -> PCollection<T>)
>
> On Thu, Mar 21, 2024 at 2:57 PM Valentyn Tymofieiev via dev <
> [email protected]> wrote:
>
>> Hi, you can use beam.Flatten() instead.
>>
>> On Thu, Mar 21, 2024 at 10:55 AM Joey Tran <[email protected]>
>> wrote:
>>
>>> Hey all,
>>>
>>> Using an identity function for FlatMap comes up more often than using
>>> FlatMap without an identity function. Would it make sense to use the
>>> identity function as a default?
>>>
>>>
>>>
>>>

Reply via email to