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
SELECT * | |
FROM [bigquery-public-data:github_repos.contents] | |
WHERE id IN (SELECT id FROM ( | |
SELECT * | |
FROM [bigquery-public-data:github_repos.files] | |
WHERE path = 'package.json' | |
AND ref = 'refs/heads/master' | |
)) |
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
// The UDF | |
function getTasks(row, emit) { | |
if (row.jsonScripts) { | |
x = JSON.parse(row.jsonScripts) | |
if (x !== null && typeof x === 'object') { | |
tasksCounter = 0 | |
Object.keys(x).forEach(function(entry) { | |
if (validTask(x, entry)) { | |
tasksCounter++; | |
} |
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
SELECT tasksCounter, (count(distinct projectID) / 286140 * 100) as percent | |
FROM [scripts] | |
GROUP BY tasksCounter | |
ORDER BY tasksCounter |
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
SELECT taskName, (count(*) / 974274 * 100) as percent | |
FROM [scripts] | |
GROUP BY taskName | |
ORDER BY percent DESC |
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
SELECT task, (count(distinct projectID) / 974274 * 100) as percent | |
FROM [scripts] | |
GROUP BY task | |
ORDER BY percent DESC |
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
SELECT scripts.taskType as taskType, scripts.percent as percent, types.group as type | |
FROM ( | |
SELECT taskType, (count(distinct projectID) / 286140 * 100) as percent | |
FROM | |
(SELECT *, 'nodemon' as taskType FROM [scripts] where REGEXP_MATCH(task, r'(\bnodemon\b)')), | |
(SELECT *, 'pm2' as taskType FROM [scripts] where REGEXP_MATCH(task, r'(\bpm2\b)')), | |
(SELECT *, 'istanbul' as taskType FROM [scripts] where REGEXP_MATCH(task, r'(\bistanbul\b)')), | |
(SELECT *, 'jsdoc' as taskType FROM [scripts] where REGEXP_MATCH(task, r'(\bjsdoc\b)')), | |
(SELECT *, 'documentation' as taskType FROM [scripts] where REGEXP_MATCH(task, r'(\bdocumentation\b)')), | |
(SELECT *, 'make' as taskType FROM [scripts] where REGEXP_MATCH(task, r'(\bmake\b)')), |
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
SELECT scripts.taskType as taskType, scripts.percent as percent, types.group as type | |
FROM ( | |
SELECT taskType, (count(distinct projectID) / 6689 * 100) as percent | |
FROM | |
(SELECT *, 'nodemon' as taskType FROM [scripts] where REGEXP_MATCH(task, r'(\bnodemon\b)')), | |
(SELECT *, 'pm2' as taskType FROM [scripts] where REGEXP_MATCH(task, r'(\bpm2\b)')), | |
(SELECT *, 'istanbul' as taskType FROM [scripts] where REGEXP_MATCH(task, r'(\bistanbul\b)')), | |
(SELECT *, 'jsdoc' as taskType FROM [scripts] where REGEXP_MATCH(task, r'(\bjsdoc\b)')), | |
(SELECT *, 'documentation' as taskType FROM [scripts] where REGEXP_MATCH(task, r'(\bdocumentation\b)')), | |
(SELECT *, 'make' as taskType FROM [scripts] where REGEXP_MATCH(task, r'(\bmake\b)')), |
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
SELECT scripts.taskType as taskType, scripts.percent as percent, types.group as type | |
FROM ( | |
SELECT taskType, (count(distinct projectID) / 202808 * 100) as percent | |
FROM | |
(SELECT *, 'nodemon' as taskType FROM [scripts] where REGEXP_MATCH(task, r'(\bnodemon\b)')), | |
(SELECT *, 'pm2' as taskType FROM [scripts] where REGEXP_MATCH(task, r'(\bpm2\b)')), | |
(SELECT *, 'istanbul' as taskType FROM [scripts] where REGEXP_MATCH(task, r'(\bistanbul\b)')), | |
(SELECT *, 'jsdoc' as taskType FROM [scripts] where REGEXP_MATCH(task, r'(\bjsdoc\b)')), | |
(SELECT *, 'documentation' as taskType FROM [scripts] where REGEXP_MATCH(task, r'(\bdocumentation\b)')), | |
(SELECT *, 'make' as taskType FROM [scripts] where REGEXP_MATCH(task, r'(\bmake\b)')), |
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
SELECT task, (count(distinct projectID) / 202808 * 100) as percent | |
FROM [scripts] | |
WHERE taskName = 'test' | |
GROUP BY task | |
ORDER BY percent DESC |
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
SELECT task, (count(distinct projectID) / 107646 * 100) as percent | |
FROM [scripts] | |
WHERE taskName = 'start' | |
GROUP BY task | |
ORDER BY percent DESC |
OlderNewer