You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@beam.apache.org by Iñigo San Jose <jo...@google.com> on 2020/06/04 17:14:07 UTC

[PROPOSAL] Mean Fn without_defaults()

Hi all!

Some time ago I was tinkering with A. Beam and I encountered the
typical error when using Global Combiners and windows (the need of
without_defaults). I was actually using the Mean function and I noticed
that I couldn't use the without_defaults() option and I needed to use
"CombineGlobally(MeanCombineFn()).without_defaults()".

I checked the Python code [1] and I made a "fix" to be able to use
Mean.Globally().without_defaults() without running into errors. Please find
attached both the quick tests I ran and the code itself of the file [1]
modified.

I was considering making a pull request to Apache Beam, but I would like to
discuss it with someone before in case there is a reason for not using
`without_defaults()`  there. I would highly appreciate your feedback on
this.

Thanks a lot,
Iñigo

PS: I also tried the same approach with Count, but I couldn't make it work
(I think because of the accumulators)

PS2: This was made in A. Beam 2.20.0, but should also work in 2.21.0


[1]
https://beam.apache.org/releases/pydoc/2.20.0/_modules/apache_beam/transforms/combiners.html#Mean
<https://beam.apache.org/releases/pydoc/2.17.0/_modules/apache_beam/transforms/combiners.html#Mean>

-- 

*•** Iñigo San Jose | joseinigo@google.coom*
*•** Big Data *Technical Solutions Engineer T2
*• *Google Cloud Platform
• *Google, Dublin*

Re: [PROPOSAL] Mean Fn without_defaults()

Posted by Robert Bradshaw <ro...@google.com>.
Thanks for looking at this. I think it makes sense. If you could make a
pull request that would be great; it'd be much easier to discuss there.

On Thu, Jun 4, 2020 at 10:18 AM Iñigo San Jose <jo...@google.com> wrote:

> Hi all!
>
> Some time ago I was tinkering with A. Beam and I encountered the
> typical error when using Global Combiners and windows (the need of
> without_defaults). I was actually using the Mean function and I noticed
> that I couldn't use the without_defaults() option and I needed to use
> "CombineGlobally(MeanCombineFn()).without_defaults()".
>
> I checked the Python code [1] and I made a "fix" to be able to use
> Mean.Globally().without_defaults() without running into errors. Please find
> attached both the quick tests I ran and the code itself of the file [1]
> modified.
>
> I was considering making a pull request to Apache Beam, but I would like
> to discuss it with someone before in case there is a reason for not using
> `without_defaults()`  there. I would highly appreciate your feedback on
> this.
>
> Thanks a lot,
> Iñigo
>
> PS: I also tried the same approach with Count, but I couldn't make it work
> (I think because of the accumulators)
>
> PS2: This was made in A. Beam 2.20.0, but should also work in 2.21.0
>
>
> [1]
> https://beam.apache.org/releases/pydoc/2.20.0/_modules/apache_beam/transforms/combiners.html#Mean
> <https://beam.apache.org/releases/pydoc/2.17.0/_modules/apache_beam/transforms/combiners.html#Mean>
>
> --
>
> *•** Iñigo San Jose | joseinigo@google.coom*
> *•** Big Data *Technical Solutions Engineer T2
> *• *Google Cloud Platform
> • *Google, Dublin*
>
>
>