Skip to content

Add bundle-local deduplication for time series and fix metric counter… - #693

Merged
vish-cs merged 1 commit into
datacommonsorg:masterfrom
vish-cs:timeseries
Jul 30, 2026
Merged

Add bundle-local deduplication for time series and fix metric counter…#693
vish-cs merged 1 commit into
datacommonsorg:masterfrom
vish-cs:timeseries

Conversation

@vish-cs

@vish-cs vish-cs commented Jul 28, 2026

Copy link
Copy Markdown
Contributor
  • Implement bundle-local deduplication in ExtractTimeSeriesFn using @StartBundle and a bundle-scoped HashSet to reduce 95%+ of duplicate time series keys before global Dataflow shuffle.
  • Refactor anonymous inner DoFn classes in GraphReader (CountTimeSeriesFn, ExtractSeriesFromOptimizedFn, ExtractObservationsFromOptimizedFn, GraphToNodesFn, GraphToEdgesFn) into static named DoFn classes with private final Counter fields to ensure reliable Beam metric reporting in Dataflow.
  • Add unit test testExtractTimeSeriesFn_BundleDeduplication in GraphReaderTest.

@codacy-production

codacy-production Bot commented Jul 28, 2026

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 1 medium · 1 minor

Alerts:
⚠ 2 issues (≤ 0 issues of at least minor severity)

Results:
2 new issues

Category Results
CodeStyle 1 minor
Complexity 1 medium

View in Codacy

🟢 Metrics 5 complexity

Metric Results
Complexity 5

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors GraphReader by replacing anonymous inner DoFn classes with named static inner classes to improve code organization. It also introduces bundle-scoped deduplication of TimeSeries in ExtractTimeSeriesFn using a transient Set initialized in @StartBundle, and adds a corresponding unit test. The feedback suggests clearing this set in @FinishBundle to prevent potential memory retention on long-running Beam workers.

@vish-cs
vish-cs requested a review from rohitkumarbhagat July 28, 2026 14:25
Comment thread pipeline/util/src/main/java/org/datacommons/ingestion/util/GraphReader.java Outdated
… serialization

- Implement bundle-local deduplication in ExtractTimeSeriesFn using @StartBundle and a bundle-scoped HashSet to reduce 95%+ of duplicate time series keys before global Dataflow shuffle.
- Refactor anonymous inner DoFn classes in GraphReader (CountTimeSeriesFn, ExtractSeriesFromOptimizedFn, ExtractObservationsFromOptimizedFn, GraphToNodesFn, GraphToEdgesFn) into static named DoFn classes with private final Counter fields to ensure reliable Beam metric reporting in Dataflow.
- Add unit test testExtractTimeSeriesFn_BundleDeduplication in GraphReaderTest.
@vish-cs
vish-cs enabled auto-merge (squash) July 30, 2026 05:42
@vish-cs
vish-cs merged commit 3d9b137 into datacommonsorg:master Jul 30, 2026
10 of 11 checks passed
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