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

Fix Async DoFn to emit element with restored metadata #5441

Merged
merged 3 commits into from
Aug 13, 2024

Conversation

RustedBones
Copy link
Contributor

flush call from the processElement was not propagating the original element's window and timestamp.

OutputReceiver<KV<Input, TryWrapper>> out,
BoundedWindow window) {
inputCount++;
flush(r -> out.output(KV.of(r.input, r.output)));
Copy link
Contributor Author

@RustedBones RustedBones Aug 7, 2024

Choose a reason for hiding this comment

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

Looks we were outputing using the current element's metadata

Copy link
Contributor

@clairemcginty clairemcginty left a comment

Choose a reason for hiding this comment

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

lgtm after rebasing the bigtable changes :)

@RustedBones RustedBones force-pushed the output-windowed-value branch 3 times, most recently from 9a818b1 to fadba86 Compare August 8, 2024 10:53
@RustedBones RustedBones changed the title Fix AsyncBatchLookup to emit element with restored metadata Fix Async DoFn to emit element with restored metadata Aug 8, 2024
Copy link

codecov bot commented Aug 8, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 61.31%. Comparing base (25c6987) to head (063cf26).

Files Patch % Lines
...spotify/scio/transforms/ScalaAsyncLookupDoFn.scala 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5441      +/-   ##
==========================================
+ Coverage   61.29%   61.31%   +0.02%     
==========================================
  Files         311      312       +1     
  Lines       11062    11068       +6     
  Branches      774      792      +18     
==========================================
+ Hits         6780     6786       +6     
  Misses       4282     4282              

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

@RustedBones
Copy link
Contributor Author

@clairemcginty updated the PR. All async DoFn are affected

@@ -155,40 +159,58 @@ public void startBundle(StartBundleContext context) {
semaphore.release(maxPendingRequests);
}

// kept for binary compatibility. Must not be used
// TODO: remove in 0.15.0
@Deprecated
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this deprecation warning get logged on the user's side? I guess only if they're pulling in an older Beam version that uses the old API, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only if extending the class and overriding this method which should never happen.
However a library compiled with the old API will call this method, so I've left it for now.

@@ -25,33 +25,33 @@ import scala.util.{Failure, Success, Try}
/**
* A [[org.apache.beam.sdk.transforms.DoFn DoFn]] that performs asynchronous lookup using the
* provided client for Scala [[Future]].
* @tparam A
* @tparam Input
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice refactor here 👍 much clearer

@RustedBones RustedBones merged commit 27fd3ca into main Aug 13, 2024
12 checks passed
@RustedBones RustedBones deleted the output-windowed-value branch August 13, 2024 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants