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

[Go] Ensure iterated and emitted types are registered. #23890

Merged
merged 3 commits into from
Nov 2, 2022
Merged

Conversation

lostluck
Copy link
Contributor

Fixes #23889

Resolves an issue with a pattern for transform package authors where they receive a given type from users, where that received type wouldn't be registered, leading to potential issues at authoring and testing time.

Transforms registered with register won't have types in their emitters or iterators registered due to complexities WRT generics. Instead, also ensure those types are registered with the Iter and Emitter* methods.

Also moves the iterator and emitter tests to co-aligned files, to make them easier to find.


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.

@codecov
Copy link

codecov bot commented Oct 28, 2022

Codecov Report

Merging #23890 (47e4ad0) into master (68aee2f) will decrease coverage by 0.54%.
The diff coverage is 93.10%.

❗ Current head 47e4ad0 differs from pull request most recent head 9956094. Consider uploading reports for the commit 9956094 to get more accurate results

@@            Coverage Diff             @@
##           master   #23890      +/-   ##
==========================================
- Coverage   73.84%   73.30%   -0.55%     
==========================================
  Files         707      720      +13     
  Lines       95746    96059     +313     
==========================================
- Hits        70708    70414     -294     
- Misses      23721    24329     +608     
+ Partials     1317     1316       -1     
Flag Coverage Δ
go 51.10% <93.10%> (+0.04%) ⬆️

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

Impacted Files Coverage Δ
...s/go/pkg/beam/core/runtime/graphx/schema/schema.go 65.88% <0.00%> (-0.12%) ⬇️
sdks/go/pkg/beam/register/emitter.go 54.05% <93.33%> (+6.36%) ⬆️
sdks/go/pkg/beam/register/iter.go 72.22% <100.00%> (+5.00%) ⬆️
...apache_beam/typehints/pandas_type_compatibility.py 94.95% <0.00%> (-0.85%) ⬇️
...s/python/apache_beam/runners/portability/stager.py 85.54% <0.00%> (-0.73%) ⬇️
sdks/python/apache_beam/runners/direct/executor.py 96.46% <0.00%> (-0.55%) ⬇️
...hon/apache_beam/runners/worker/bundle_processor.py 93.30% <0.00%> (-0.25%) ⬇️
...s/python/apache_beam/io/gcp/bigquery_file_loads.py 87.24% <0.00%> (-0.09%) ⬇️
sdks/python/apache_beam/typehints/batch.py 90.38% <0.00%> (-0.07%) ⬇️
sdks/python/apache_beam/portability/common_urns.py 100.00% <0.00%> (ø)
... and 42 more

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

@github-actions
Copy link
Contributor

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

R: @riteshghorse 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).

@@ -113,7 +123,9 @@ func Iter1[T any]() {
registerFunc := func(s exec.ReStream) exec.ReusableInput {
return &iter1[T]{s: s}
}
exec.RegisterInput(reflect.TypeOf(i).Elem(), registerFunc)
itT := reflect.TypeOf(i).Elem()
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @lostluck
I just started a test run with your changes applied with the bigtable io connector (#23411).
Unfortunately I still ran into the following error: reflect.Set: value of type struct { RowKey string; Ops []struct { Family string; Column string; Ts int64; Value []uint8 }; GroupKey string } is not assignable to type bigtableio.Mutation.
I played around with this implementation but wasn't able to make it work. My knowledge on the reflect package is somehow limited though.

@lostluck
Copy link
Contributor Author

lostluck commented Oct 29, 2022 via email

@lostluck
Copy link
Contributor Author

lostluck commented Oct 29, 2022 via email

@lostluck
Copy link
Contributor Author

RFAL

capthiron added a commit to capthiron/beam that referenced this pull request Nov 1, 2022
- bugfix apache#23890 will ensure that
  register.Iter1 will implicitly register bigtableio.Mutation
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.

The changes looks good to me, thanks!

@riteshghorse
Copy link
Contributor

Run Go PostCommit

@lostluck lostluck merged commit 2b33bba into master Nov 2, 2022
@lostluck lostluck deleted the beam23889 branch December 1, 2022 05:05
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.

[Bug][Go SDK]: register.Iter* and register.Emit* don't register parameter types.
3 participants