Skip to content

[Java] Extract common timestamp output DoFn - #40077

Open
xujiantop-crypto wants to merge 1 commit into
apache:masterfrom
xujiantop-crypto:refactor/shared-timestamp-output-dofn
Open

[Java] Extract common timestamp output DoFn#40077
xujiantop-crypto wants to merge 1 commit into
apache:masterfrom
xujiantop-crypto:refactor/shared-timestamp-output-dofn

Conversation

@xujiantop-crypto

Copy link
Copy Markdown

Extract a package-private OutputWithTimestampDoFn shared by
WithTimestamps.AddTimestampsDoFn and
Create.TimestampedValues.ConvertTimestamps.

The existing transform structure is intentionally preserved. In particular,
Create.TimestampedValues still creates an intermediate
PCollection<TimestampedValue<T>>, uses TimestampedValueCoder, restores the
output coder, and retains the ConvertTimestamps transform name. This avoids
the runner matching issue that previously occurred when
TimestampedValues inherited from Create.Values.

WithTimestamps continues to preserve its null timestamp validation and
allowed timestamp skew behavior.

Tests:

  • :sdks:java:core:test for WithTimestampsTest and CreateTest
  • :runners:direct-java:needsRunnerTest for WithTimestampsTest and CreateTest
  • Pipeline renderer tests
  • :sdks:java:core:spotlessJavaCheck
  • :sdks:java:core:javadoc

Fixes #18350

Signed-off-by: xujiantop-crypto <265865031+xujiantop-crypto@users.noreply.github.com>
@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.24%. Comparing base (e33cd10) to head (2473d9c).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #40077      +/-   ##
============================================
- Coverage     58.52%   57.24%   -1.28%     
+ Complexity     5980     3695    -2285     
============================================
  Files          1459     1200     -259     
  Lines        208448   194031   -14417     
  Branches       5364     3889    -1475     
============================================
- Hits         121985   111070   -10915     
+ Misses        82166    79362    -2804     
+ Partials       4297     3599     -698     
Flag Coverage Δ
java 72.05% <ø> (-1.15%) ⬇️

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

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @kennknowles for label java.

This pull request likely touches a core component ("core" label). Please review with scrutiny.

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

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).

@kennknowles

Copy link
Copy Markdown
Member

Hello! Thanks for contributing! I'm sorry we left that GitHub issue open. I don't actually think we should do this, for two reasons:

  1. We should avoid inheritance with abstract members, and use composition instead.
  2. This logic is simple enough it is better to just keep it duplicated in multiple places rather than introduce a dependency between them.

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.

Extract common class for WithTimestamps.AddTimestampsDoFn and Create.TimestampedValues.ConvertTimestamps

2 participants