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

fix(ingest): kafka - properly picking doc from union type #6472

Merged
merged 10 commits into from
Nov 23, 2022

Conversation

treff7es
Copy link
Contributor

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 Nov 17, 2022
@github-actions
Copy link

github-actions bot commented Nov 17, 2022

Unit Test Results (build & test)

621 tests  ±0   617 ✔️ ±0   15m 45s ⏱️ -14s
157 suites ±0       4 💤 ±0 
157 files   ±0       0 ±0 

Results for commit 6eea804. ± Comparison against base commit 250f7ce.

♻️ This comment has been updated with latest results.

@treff7es treff7es changed the title fix(ingest): kafka - setting doc on union based on the non null property fix(ingest): kafka - properly picking doc from union type Nov 17, 2022
@treff7es
Copy link
Contributor Author

At union types we either have to get the doc from the union's doc itself (if it exists) or if it doesn't then pick it from the non null type's doc.

@github-actions
Copy link

github-actions bot commented Nov 17, 2022

Unit Test Results (metadata ingestion)

       8 files  ±0         8 suites  ±0   58m 55s ⏱️ +18s
   759 tests ±0     756 ✔️ +1  3 💤 ±0  0  - 1 
1 520 runs  ±0  1 513 ✔️ +1  7 💤 ±0  0  - 1 

Results for commit 6eea804. ± Comparison against base commit 250f7ce.

♻️ This comment has been updated with latest results.

@@ -289,8 +289,14 @@ def emit(self) -> Generator[SchemaField, None, None]:
)

description = self._description
if description is None:
description = schema.props.get("doc", None)
if self._schema.props.get("doc", None) is None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a simpler idiom we could use?

Something like:

schema_description = self._schema_props.get("doc") or actual_schema.props.get("doc")

description = f"{schema_description or ''}{description or ''}"

... rest of code

@treff7es treff7es requested a review from shirshanka November 18, 2022 14:41
@@ -314,6 +322,8 @@ def emit(self) -> Generator[SchemaField, None, None]:
description = (
f"<span style=\"color:red\">DEPRECATED: {merged_props['deprecated']}</span>\n"
+ description
if description
Copy link
Contributor

Choose a reason for hiding this comment

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

doesn't this effectively do the same thing you are trying to prevent above?

If description is None we set it to "" ... so why not just set description to "" above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A bunch of other integration test expects this property as None and not empty string in their golden files. (like Glue, Hive, etc...) and those broke when I had empty string.
This way the output is identical what we had before.

@treff7es treff7es merged commit 8d525d6 into datahub-project:master Nov 23, 2022
cccs-Dustin pushed a commit to CybercentreCanada/datahub that referenced this pull request Feb 1, 2023
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.

3 participants