Last active
August 10, 2022 06:50
-
-
Save aymanfarhat/93e72177b67ffeada662d262bfe5c7a0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#Copyright 2022 Google LLC. | |
#SPDX-License-Identifier: Apache-2.0 | |
WITH | |
initial_log AS ( | |
SELECT | |
commit_hash, | |
author_name, | |
author_email, | |
TIMESTAMP_SECONDS(author_date) AS author_date, | |
REGEXP_EXTRACT(file, "(tools|examples)/[^/]+/.*") AS type, | |
REGEXP_EXTRACT(file, "[tools|examples]/([^/]+)/.*") AS sub_repo, | |
file, | |
FROM | |
`myproject.gitlogs.pso` | |
WHERE | |
REGEXP_EXTRACT(file, "(tools|examples)/[^/]+/.*") IS NOT NULL | |
AND REGEXP_EXTRACT(file, "[tools|examples]/([^/]+)/.*") IS NOT NULL) | |
SELECT | |
author_email, | |
sub_repo, | |
COUNT(DISTINCT commit_hash) AS commits_in_folder | |
FROM | |
initial_log | |
GROUP BY | |
author_email, | |
sub_repo |
This file contains hidden or 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
#Copyright 2022 Google LLC. | |
#SPDX-License-Identifier: Apache-2.0 | |
SELECT | |
commit_hash, | |
author_name, | |
author_email, | |
TIMESTAMP_SECONDS(author_date) AS author_date, | |
REGEXP_EXTRACT(file, "(tools|examples)/[^/]+/.*") AS type, | |
REGEXP_EXTRACT(file, "[tools|examples]/([^/]+)/.*") AS sub_repo, | |
file, | |
FROM | |
`myproject.gitlogs.pso` | |
WHERE | |
REGEXP_EXTRACT(file, "(tools|examples)/[^/]+/.*") IS NOT NULL | |
AND REGEXP_EXTRACT(file, "[tools|examples]/([^/]+)/.*") IS NOT NULL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment