-
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
prevent NoneType exception when profiling empty datasets #3144
prevent NoneType exception when profiling empty datasets #3144
Conversation
@@ -219,7 +219,8 @@ def _handle_convert_column_evrs( # noqa: C901 (complexity) | |||
elif exp == "expect_column_values_to_not_be_null": | |||
column_profile.nullCount = res["unexpected_count"] | |||
if "unexpected_percent" in res: |
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 the system can handle column_profile.nullProportion = None
, so how about only setting it only when both of these are true.
So I guess:
if "unexpected_percent" in res and res["unexpected_percent"] is not None:
column_profile.nullProportion = res["unexpected_percent"]
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.
That makes totally sense. I will try that!
@sgomezvillamor : seems like lint is complaining (https://github.com/linkedin/datahub/pull/3144/checks?check_run_id=3402002680) You can fix it via: Also I had a suggestion for rewriting the check and combining it with the previous. |
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!
…ts (datahub-project#3144) Co-authored-by: Sergio Gómez <[email protected]>
…ts (datahub-project#3144) Co-authored-by: Sergio Gómez <[email protected]>
…ts (datahub-project#3144) Co-authored-by: Sergio Gómez <[email protected]>
res["unexpected_percent"]
isNoneType
when profiling empty datasets and the division causes an exception. This PR is preventing that scenario.Issue #3132
Checklist