Skip to content

Add provenance mcf to import files#605

Open
vish-cs wants to merge 1 commit into
datacommonsorg:masterfrom
vish-cs:provenance
Open

Add provenance mcf to import files#605
vish-cs wants to merge 1 commit into
datacommonsorg:masterfrom
vish-cs:provenance

Conversation

@vish-cs

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

Copy link
Copy Markdown
Contributor

No description provided.

@codacy-production

codacy-production Bot commented Jul 1, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 7 complexity

Metric Results
Complexity 7

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.

@vish-cs vish-cs requested a review from ajaits July 1, 2026 11:42

@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 introduces fallback logic for resolving the provenance of nodes in GraphReader.java to handle base DC cases where the provenance MCF node might not be present in the data files. It replaces direct usage of provenance or importName with a resolved provenance using a new helper method getProvenance. The reviewer suggested ensuring that getProvenance never returns null (even if fallbackProvenance is null) to prevent potential NullPointerExceptions downstream.

I am having trouble creating individual review comments. Click here to see my feedback.

pipeline/util/src/main/java/org/datacommons/ingestion/util/GraphReader.java (504-507)

medium

To prevent potential NullPointerExceptions (for example, in Edge.equals which calls provenance.equals(...) without a null check), ensure that getProvenance never returns null even if fallbackProvenance is null.

  private static String getProvenance(PropertyValues pv, String fallbackProvenance) {
    String provenance = GraphUtils.getPropVal(pv, "provenance");
    if (!provenance.isEmpty()) {
      return provenance;
    }
    return fallbackProvenance != null ? fallbackProvenance : "";
  }

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