Skip to content

Update ingestion pipeline to handle timeseries table#528

Merged
vish-cs merged 2 commits into
datacommonsorg:masterfrom
vish-cs:schema
Jun 12, 2026
Merged

Update ingestion pipeline to handle timeseries table#528
vish-cs merged 2 commits into
datacommonsorg:masterfrom
vish-cs:schema

Conversation

@vish-cs

@vish-cs vish-cs commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

DataCommons Spanner Graph is migrating to a new schema to introduce separate TimeSeries and Observation tables instead of the currently Observation table. This allows removing the Observation proto used to store the timeseries. This PR updates the ingestion pipeline to populate data into the tables with the new schema. For this, we eliminate the step to build the optimized graph (timeseries) from the input observations. Instead, we directly create timeseries and observation mutations from the input observation. This avoids the costly group by operation on the observations.

@codacy-production

codacy-production Bot commented Jun 8, 2026

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 3 high · 2 medium · 5 minor

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

Results:
10 new issues

Category Results
Compatibility 3 high
CodeStyle 5 minor
Complexity 2 medium

View in Codacy

🟢 Metrics 70 complexity · 6 duplication

Metric Results
Complexity 70
Duplication 6

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[bot]

This comment was marked as outdated.

@vish-cs vish-cs force-pushed the schema branch 4 times, most recently from 7058981 to 65a60e7 Compare June 9, 2026 08:38
@vish-cs

vish-cs commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@vish-cs vish-cs requested a review from rohitkumarbhagat June 9, 2026 08:52

@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 migrates the Spanner storage schema and ingestion pipeline from a protobuf-based Observations column to a relational model featuring a TimeSeries table (storing metadata as JSON) and an interleaved Observation table for individual data points. Feedback focuses on performance and maintainability improvements: optimizing GraphReader.extractObservations by constructing the TimeSeriesKey once outside the loop rather than for every data point, refactoring SpannerClient.toObservationKVMutations to reuse toTimeSeriesMutation to eliminate duplicate mutation-building logic, and simplifying toObservation to accept TimeSeriesKey directly while updating the corresponding tests.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread pipeline/util/src/main/java/org/datacommons/ingestion/util/GraphReader.java Outdated
Comment thread pipeline/util/src/test/java/org/datacommons/ingestion/util/GraphReaderTest.java Outdated
@vish-cs vish-cs force-pushed the schema branch 5 times, most recently from 29592ac to f8292be Compare June 10, 2026 08:29
@vish-cs vish-cs requested a review from n-h-diaz June 10, 2026 15:53

@n-h-diaz n-h-diaz 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.

Thanks!

I had a few questions mostly relating to what the final schema looks like (I was following the schema in datcom-store.dc-graph-staging.dc_graph)

Comment thread pipeline/data/src/main/java/org/datacommons/ingestion/data/TimeSeries.java Outdated
Comment thread pipeline/data/src/main/java/org/datacommons/ingestion/data/TimeSeries.java Outdated
Comment thread pipeline/workflow/ingestion-helper/clients/schema.sql
Comment thread pipeline/workflow/ingestion-helper/clients/schema.sql
Comment thread pipeline/workflow/ingestion-helper/clients/schema.sql
Comment thread pipeline/workflow/ingestion-helper/clients/schema.sql
Comment thread pipeline/workflow/ingestion-helper/schema.sql Outdated
@vish-cs vish-cs merged commit 6cb7571 into datacommonsorg:master Jun 12, 2026
9 of 10 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.

3 participants