-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(model): fixes DashboardContainsDashboard relationship in DashboardInfo aspect #12433
base: master
Are you sure you want to change the base?
fix(model): fixes DashboardContainsDashboard relationship in DashboardInfo aspect #12433
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable fix.
Hoping that re-ingestion of this aspect will automatically update graph index. Wondering if you've tested this.
Not tested and not sure how to test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a note to the updating-datahub.md doc to call out that users of Sigma and PowerBI Apps ingestion may need to run a targeted reindex if they need updated metadata on these edges
I doubt there's many cases of that, but would be good to mention anyways
…ashboardContainsDashboard
…ashboardContainsDashboard
…ashboardContainsDashboard
… add missing case for dashboards
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Might be worth getting a quick look from @RyanHolstien
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think typically we add an upgrade job that runs once to reindex these relationships when we update them, would also like to see some Java side unit tests
@@ -52,6 +55,22 @@ public DashboardInfoPatchBuilder removeDatasetEdge(@Nonnull DatasetUrn urn) { | |||
return this; | |||
} | |||
|
|||
// Simplified with just Urn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add tests for these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found these tests for DashboardInfoPatchBuilder
datahub/metadata-integration/java/datahub-client/src/test/java/datahub/client/patch/PatchTest.java
Line 619 in 79aa40f
new DashboardInfoPatchBuilder() |
I will add it there, even if they are all @Ignore
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in commit 49e0dc2
@@ -74,6 +75,12 @@ public JsonNode transformFields(JsonNode baseNode) { | |||
DATASET_EDGES_FIELD_NAME, | |||
Collections.singletonList(DESTINATION_URN_FIELD_NAME)); | |||
|
|||
transformedNode = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there isn't already a test for this let's create one, or if there is add in mapping this field
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had already added a test for DashboardInfoTemplate
in https://github.com/datahub-project/datahub/pull/12433/files#diff-b6808c495535fbf32144cbc4e6f16eb762b55c377c63ef929758d21760c28437
The test operates on applyPatch
method, which goes through both transformFields
and rebaseFields
methods, as can be seen in
datahub/entity-registry/src/main/java/com/linkedin/metadata/aspect/patch/template/Template.java
Lines 51 to 86 in 47134c2
default T applyPatch(RecordTemplate recordTemplate, JsonPatch jsonPatch) | |
throws JsonProcessingException { | |
TemplateUtil.validatePatch(jsonPatch); | |
JsonNode transformed = populateTopLevelKeys(preprocessTemplate(recordTemplate), jsonPatch); | |
try { | |
// Hack in a more efficient patcher. Even with the serialization overhead 140% faster | |
JsonObject patched = | |
jsonPatch.apply( | |
Json.createReader(new StringReader(OBJECT_MAPPER.writeValueAsString(transformed))) | |
.readObject()); | |
JsonNode postProcessed = rebaseFields(OBJECT_MAPPER.readTree(patched.toString())); | |
return RecordUtils.toRecordTemplate(getTemplateType(), postProcessed.toString()); | |
} catch (JsonProcessingException e) { | |
throw new RuntimeException( | |
String.format( | |
"Error performing JSON PATCH on aspect %s. Patch: %s Target: %s", | |
recordTemplate.schema().getName(), jsonPatch, transformed.toString()), | |
e); | |
} | |
} | |
/** | |
* Returns a json representation of the template, modified for template based operations to be | |
* compatible with patch semantics. | |
* | |
* @param recordTemplate template to be transformed into json | |
* @return a {@link JsonNode} representation of the template | |
* @throws JsonProcessingException if there is an issue converting the input to JSON | |
*/ | |
default JsonNode preprocessTemplate(RecordTemplate recordTemplate) | |
throws JsonProcessingException { | |
T subtype = getSubtype(recordTemplate); | |
JsonNode baseNode = OBJECT_MAPPER.readTree(RecordUtils.toJsonString(subtype)); | |
return transformFields(baseNode); | |
} |
@RyanHolstien I have added the requested reindex job for the upgrade in commit b582b47 Considering we are fixing the |
…ashboardContainsDashboard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
This fixes:
DashboardContainsDashboard
relationship model forDashboardInfo
aspect modelDashboardPatchBuilder#add_chart_edge
DashboardPatchBuilder#add_dashboard
Checklist