Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add combining state support #22826

Merged
merged 2 commits into from
Aug 24, 2022

Conversation

damccorm
Copy link
Contributor

@damccorm damccorm commented Aug 23, 2022

This continues to grow our state support by adding bag state support. Once this is in, I'll add a follow up PR with an integration test. In the meantime, I tested manually by running the hacked wordcount found here - https://github.com/damccorm/beam/pull/88/files#diff-46f0bd8f9f6b541e840079960d684ba78e6513f1293b673d08faaec94d48a234 - and it produced output like:

sword(0 0 0 0 0): 1
sword(1 1 1 1 1): 1
sword(2 2 2 2 2): 1
sword(3 3 3 3 3): 1
sword(4 4 4 4 4): 1
sword(5 5 5 5 5): 1
sword(6 6 6 6 6): 1
sword(7 7 7 7 7): 1
sword(8 8 8 8 8): 1
sword(9 9 9 9 9): 1
sword(10 10 10 10 10): 1
sword(11 11 11 11 11): 1
sword(12 12 12 12 12): 1
sword(13 13 13 13 13): 1
sword(14 14 14 14 14): 1
sword(15 15 15 15 15): 1
sword(16 16 16 16 16): 1
clay(0 0 0 0 0): 1
cap(0 0 0 0 0): 1
cap(1 1 1 1 1): 1
cap(2 2 2 2 2): 1
...

Part of #22736


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI.

@github-actions github-actions bot added the go label Aug 23, 2022
@codecov
Copy link

codecov bot commented Aug 23, 2022

Codecov Report

Merging #22826 (d978f85) into master (80ced0f) will decrease coverage by 0.05%.
The diff coverage is 40.80%.

@@            Coverage Diff             @@
##           master   #22826      +/-   ##
==========================================
- Coverage   73.93%   73.88%   -0.06%     
==========================================
  Files         713      713              
  Lines       94151    94318     +167     
==========================================
+ Hits        69610    69683      +73     
- Misses      23256    23347      +91     
- Partials     1285     1288       +3     
Flag Coverage Δ
go 51.18% <40.80%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
sdks/go/pkg/beam/core/graph/fn.go 84.54% <0.00%> (ø)
sdks/go/pkg/beam/core/runtime/exec/translate.go 13.20% <0.00%> (-0.35%) ⬇️
sdks/go/pkg/beam/core/runtime/exec/userstate.go 11.04% <0.00%> (-1.78%) ⬇️
sdks/go/pkg/beam/core/runtime/graphx/translate.go 39.83% <0.00%> (-1.24%) ⬇️
sdks/go/pkg/beam/core/state/state.go 75.00% <74.73%> (-0.31%) ⬇️
sdks/python/apache_beam/io/source_test_utils.py 88.01% <0.00%> (-1.39%) ⬇️
...ks/python/apache_beam/runners/worker/sdk_worker.py 89.09% <0.00%> (+0.15%) ⬆️
sdks/python/apache_beam/transforms/combiners.py 93.43% <0.00%> (+0.38%) ⬆️
...hon/apache_beam/runners/direct/test_stream_impl.py 94.02% <0.00%> (+0.74%) ⬆️
... and 1 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@damccorm
Copy link
Contributor Author

damccorm commented Aug 23, 2022

Note portable precommit is currently permared due to a licensing issue

EDIT - its since healed and the retry worked

@damccorm damccorm marked this pull request as ready for review August 23, 2022 20:46
@damccorm
Copy link
Contributor Author

R: @riteshghorse

@github-actions
Copy link
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control

@damccorm
Copy link
Contributor Author

Run GoPortable PreCommit

Copy link
Contributor

@riteshghorse riteshghorse left a comment

Choose a reason for hiding this comment

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

I think my last comment got disappeared when it was a draft PR

acc, ok, err := s.readAccumulator(p)
if !ok || err != nil {
var val T3
return val, ok, err
Copy link
Contributor

@riteshghorse riteshghorse Aug 24, 2022

Choose a reason for hiding this comment

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

since this function returns an empty list in this if statement, do we expect users to specify type as []int or just int and return []T3 from here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This won't actually return an empty list - it will return a variable set to the null value of T3. So if T3 is an int, it will return 0.

The expectation is that Read will always return whatever type ExtractOutput produces.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(or if there's no ExtractOutput function defined, then whatever MergeAccumulators produces. This mirrors the behavior of a normal combineFn)

Copy link
Contributor

Choose a reason for hiding this comment

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

got it, then I think this should be fine as it is.

Copy link
Contributor

@riteshghorse riteshghorse left a comment

Choose a reason for hiding this comment

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

LGTM

@damccorm damccorm merged commit ee06385 into apache:master Aug 24, 2022
@damccorm damccorm deleted the users/damccorm/combiningState branch August 24, 2022 18:30
@damccorm damccorm mentioned this pull request Aug 24, 2022
4 tasks
dedocibula pushed a commit to dedocibula/beam that referenced this pull request Sep 15, 2022
kkdoon pushed a commit to twitter-forks/beam that referenced this pull request Sep 29, 2022
cushon pushed a commit to cushon/beam that referenced this pull request Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants