Skip to content
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

feat(ingest): fix handling of unions with aliases in post restli conversion #7058

Merged
merged 4 commits into from
Jan 18, 2023

Conversation

hsheth2
Copy link
Collaborator

@hsheth2 hsheth2 commented Jan 17, 2023

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable). If a new feature has been added a Usage Guide has been added for the same.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Updating DataHub

@github-actions github-actions bot added the ingestion PR or Issue related to the ingestion of metadata label Jan 17, 2023
}
if (
not pre
and set(obj.keys()) == {"cost", "costType"}
Copy link
Contributor

Choose a reason for hiding this comment

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

will this check continue to work if we evolve the schema of the CostModel in the future?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no they won't work

I've added a bit more testing that will alert us any time the assumptions made here are violated by changes in the model

@hsheth2 hsheth2 changed the title feat(ingest): fix handling of field discriminators in post restli conversion feat(ingest): fix handling of unions with aliases in post restli conversion Jan 18, 2023
new_key: _json_transform(value, from_pattern, to_pattern, pre=pre)
}

if pre:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor - we can address later. "pre" is a somewhat general name for this argument. It would be useful to change name or provide docs about it as method docs for the json_transform method.

# Note that "CostCostClass" is the only usage of a union with aliases in our
# current PDL / metadata model, so the below hardcoding works.
# Because this method is brittle and prone to becoming stale, we validate
# the aforementioned assumption in our tests.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Awesome call out and docs. Thank you

Copy link
Collaborator

@jjoyce0510 jjoyce0510 left a comment

Choose a reason for hiding this comment

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

LGTM...!

@jjoyce0510 jjoyce0510 merged commit 35bd73a into datahub-project:master Jan 18, 2023
shirshanka pushed a commit to shirshanka/datahub that referenced this pull request Jan 18, 2023
ericyomi pushed a commit to ericyomi/datahub that referenced this pull request Jan 18, 2023
@hsheth2 hsheth2 deleted the cost-cost-field-disc branch February 14, 2024 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ingestion PR or Issue related to the ingestion of metadata
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants