-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ingest): consistent fingerprint for sql parsing aggregator (#12239)
- Loading branch information
1 parent
f9e2c49
commit fba0996
Showing
10 changed files
with
96 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,20 @@ def default_user_urn_builder(email: str) -> str: | |
return builder.make_user_urn(email.split("@")[0]) | ||
|
||
|
||
def extract_user_email(user: str) -> Optional[str]: | ||
"""Extracts user email from user input | ||
>>> extract_user_email('urn:li:corpuser:[email protected]') | ||
'[email protected]' | ||
>>> extract_user_email('urn:li:corpuser:abc') | ||
>>> extract_user_email('[email protected]') | ||
'[email protected]' | ||
""" | ||
if user.startswith(("urn:li:corpuser:", "urn:li:corpGroup:")): | ||
user = user.split(":")[-1] | ||
return user if "@" in user else None | ||
|
||
|
||
def make_usage_workunit( | ||
bucket_start_time: datetime, | ||
resource: ResourceType, | ||
|
@@ -104,7 +118,7 @@ def make_usage_workunit( | |
DatasetUserUsageCountsClass( | ||
user=user_urn_builder(user), | ||
count=count, | ||
userEmail=user if "@" in user else None, | ||
userEmail=extract_user_email(user), | ||
) | ||
for user, count in user_freq | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.