Skip to content

[BEAM-14470] Use lifecycle method names directly.#17790

Merged
lostluck merged 3 commits intoapache:masterfrom
lostluck:beam14470deeper
Jun 1, 2022
Merged

[BEAM-14470] Use lifecycle method names directly.#17790
lostluck merged 3 commits intoapache:masterfrom
lostluck:beam14470deeper

Conversation

@lostluck
Copy link
Contributor

@lostluck lostluck commented Jun 1, 2022

Use lifecycle method names directly, rather than excluding all exported methods on DoFns.

Breaks certain usecases with extreme number (10+) of emitter parameters, when the method doesn't have a generic representation. The static code generator works in those cases, but it isn't recommended.

The ideal work around would be to have a tagged API instead of the positional one, but that's significantly more work.

Using lifecycle names directly neutered the previous verification check anyway, so we've opted to remove that entirely. Additional tests were also added to ensure the fallthrough behavior occurs.


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).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • 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

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

@github-actions github-actions bot added the go label Jun 1, 2022
@codecov
Copy link

codecov bot commented Jun 1, 2022

Codecov Report

Merging #17790 (c511ca8) into master (ca33943) will increase coverage by 0.07%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master   #17790      +/-   ##
==========================================
+ Coverage   74.00%   74.08%   +0.07%     
==========================================
  Files         695      697       +2     
  Lines       91898    91927      +29     
==========================================
+ Hits        68013    68103      +90     
+ Misses      22639    22580      -59     
+ Partials     1246     1244       -2     
Flag Coverage Δ
go 50.76% <100.00%> (+0.27%) ⬆️

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 85.33% <100.00%> (+8.29%) ⬆️
sdks/go/pkg/beam/io/fhirio/common.go 0.00% <0.00%> (ø)
sdks/go/pkg/beam/io/fhirio/read.go 80.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ca33943...c511ca8. Read the comment docs.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 1, 2022

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @jrmccluskey for label go.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

Copy link
Contributor

@jrmccluskey jrmccluskey left a comment

Choose a reason for hiding this comment

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

LGTM, should get a look rom @damccorm as well since they should have more context

Copy link
Contributor

@damccorm damccorm left a comment

Choose a reason for hiding this comment

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

LGTM - could you please file (and link to) a Jira to revert once it is no longer breaking?

@lostluck
Copy link
Contributor Author

lostluck commented Jun 1, 2022

As discussed offline, we decided to completely remove the method restriction entirely. While this may make things a little harder for novices, it will make things harder for novices with typos in the optional methods. These should be detectable by users via testing however.

Unfortunately there's no good way of validating this on our end short of doing some sort of typo/proximity algorithm, which is likely more trouble than better documentation and clearer examples, hence the initial strict approach.

@lostluck
Copy link
Contributor Author

lostluck commented Jun 1, 2022

@damccorm PTAL

Copy link
Contributor

@damccorm damccorm left a comment

Choose a reason for hiding this comment

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

For posterity, we decided offline to remove verifyValidNames because the current change effectively circumvents that check in some cases and it doesn't make sense to only enforce it some of the time and/or leave behind an unenforced restriction. We're not planning on ever enforcing this restriction going forward (at least not without a major version bump).

}
}

func TestNewFn_SplittableDoFn(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It would probably be good to add an extra similar test case for combineFns as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I knew I missed something. Thank you!

We also have a vestigial "CompactFn" It's intended to allow CombineFns to do compression of the accumulators, but it seems it's not documented or called anywhere. Out of scope to delete it in this PR, but it could be worth implementing for user use eventually.

@lostluck lostluck merged commit 4bb3970 into apache:master Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants