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 SDK]: Implement natsio.Read transform for reading from NATS #29410

Merged
merged 2 commits into from
Dec 12, 2023

Conversation

johannaojeling
Copy link
Contributor

Implements a natsio.Read transform for reading from NATS JetStream. Fixes #29000.


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

  • 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 or the workflows README to see a list of phrases to trigger workflows.

@johannaojeling
Copy link
Contributor Author

R: @lostluck

I have taken inspiration from unbounded sources/SDFs in the Java SDK (KafkaIO, PulsarIO, etc.) and have tried to keep it simple in this first iteration. It is the first streaming connector I write so let me know if there are any best practices I'm missing out on.

Copy link
Contributor

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

Copy link

codecov bot commented Nov 14, 2023

Codecov Report

Attention: 80 lines in your changes are missing coverage. Please review.

Comparison is base (d24c40a) 37.99% compared to head (8af3489) 37.95%.
Report is 1 commits behind head on master.

❗ Current head 8af3489 differs from pull request most recent head b49d27f. Consider uploading reports for the commit b49d27f to get more accurate results

Files Patch % Lines
sdks/go/pkg/beam/io/natsio/read.go 69.86% 33 Missing and 11 partials ⚠️
sdks/go/pkg/beam/io/natsio/read_option.go 33.33% 21 Missing and 3 partials ⚠️
sdks/go/pkg/beam/io/natsio/end_estimator.go 78.12% 5 Missing and 2 partials ⚠️
sdks/go/pkg/beam/io/natsio/common.go 0.00% 2 Missing and 1 partial ⚠️
sdks/go/pkg/beam/io/natsio/time_policy.go 83.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #29410      +/-   ##
==========================================
- Coverage   37.99%   37.95%   -0.05%     
==========================================
  Files         691      695       +4     
  Lines      101309   101499     +190     
==========================================
+ Hits        38497    38520      +23     
- Misses      61213    61366     +153     
- Partials     1599     1613      +14     
Flag Coverage Δ
go 53.47% <66.10%> (-0.09%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lostluck
Copy link
Contributor

Thank you for your patience for the delay in reviewing. I've been distracted with chasing flakes with Prism, and have also fallen sick. It's going to take a little longer.

@johannaojeling
Copy link
Contributor Author

Thank you for your patience for the delay in reviewing. I've been distracted with chasing flakes with Prism, and have also fallen sick. It's going to take a little longer.

No worries, hope you feel better soon!

Copy link
Contributor

@lostluck lostluck left a comment

Choose a reason for hiding this comment

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

Thanks for your patience!

As always, your code remains a delight to read. I don't have much to add, as AFAICT you're using all the parts correctly. The trick is whether different runners split in a reasonable fashion (specifically Prism, which will probably be very aggressive).

_ []byte,
rest offsetrange.Restriction,
) []offsetrange.Restriction {
return []offsetrange.Restriction{rest}
Copy link
Contributor

Choose a reason for hiding this comment

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

OK, so this means no initial splits, so a single stream to start, and only dynamic splits will occur. I think this is correct WRT the rest of the code.

@johannaojeling
Copy link
Contributor Author

Thanks for your patience!

As always, your code remains a delight to read. I don't have much to add, as AFAICT you're using all the parts correctly. The trick is whether different runners split in a reasonable fashion (specifically Prism, which will probably be very aggressive).

Thank you for reviewing! I resolved the conflict in CHANGES.md, so if you are happy it should be good to merge. It was fun to learn more about unbounded sources 😊

@damccorm
Copy link
Contributor

Looks like there's another conflict in CHANGES.md unfortunately, @johannaojeling would you mind resolving again? @lostluck is this good to merge otherwise?

@lostluck lostluck merged commit 90e79ae into apache:master Dec 12, 2023
108 of 109 checks passed
@lostluck
Copy link
Contributor

Thank you for your patience WRT merging it in. Thanks Danny for the reminder!

@johannaojeling johannaojeling deleted the feat/natsio-read branch December 13, 2023 06:24
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.

[Feature Request][Go SDK]: NATS IO connector
3 participants