Add provenance mcf to import files#605
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 7 |
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.
There was a problem hiding this comment.
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)
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 : "";
}
No description provided.