Skip to content

Commit

Permalink
fix: case inconsistency in sql (apache#4997)
Browse files Browse the repository at this point in the history
* fix: case inconsistency in sql

* fix: weekly bug retro select repo
  • Loading branch information
abeizn authored Apr 21, 2023
1 parent 72bd5d1 commit ed29131
Show file tree
Hide file tree
Showing 22 changed files with 85 additions and 85 deletions.
6 changes: 3 additions & 3 deletions grafana/dashboards/BitBucket.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 12,
"iteration": 1679476420040,
"id": 28,
"iteration": 1682062771301,
"links": [],
"panels": [
{
Expand Down Expand Up @@ -966,5 +966,5 @@
"timezone": "",
"title": "BitBucket",
"uid": "4LzQHZa4k",
"version": 16
"version": 1
}
8 changes: 4 additions & 4 deletions grafana/dashboards/ComponentAndFileLevelMetrics.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 17,
"iteration": 1677030964408,
"id": 20,
"iteration": 1682062815355,
"links": [],
"panels": [
{
Expand Down Expand Up @@ -991,7 +991,7 @@
{
"allValue": null,
"current": {
"selected": false,
"selected": true,
"text": [
"All"
],
Expand Down Expand Up @@ -1061,5 +1061,5 @@
"timezone": "",
"title": "Component and File-level Metrics",
"uid": "KxUh7IG4z",
"version": 4
"version": 3
}
12 changes: 6 additions & 6 deletions grafana/dashboards/ContributorExperience.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 21,
"iteration": 1677590412757,
"id": 24,
"iteration": 1682062826895,
"links": [],
"panels": [
{
Expand Down Expand Up @@ -508,7 +508,7 @@
"metricColumn": "none",
"queryType": "randomWalk",
"rawQuery": true,
"rawSql": "select\n\tavg(TIMESTAMPDIFF(Minute,created_date,closed_date)/1440) as time_to_close\nfrom \n\tpull_requests pr\nwhere \n date(created_date) BETWEEN\n curdate() - INTERVAL DAYOFMONTH(curdate())-1 DAY - INTERVAL 1 month and\n curdate() - INTERVAL DAYOFMONTH(curdate()) DAY\n\tand status in ('closed', 'merged', 'declined')\n\tand pr.base_repo_id in ($repo_id)\n\n\n",
"rawSql": "select\n\tavg(TIMESTAMPDIFF(Minute,created_date,closed_date)/1440) as time_to_close\nfrom \n\tpull_requests pr\nwhere \n date(created_date) BETWEEN\n curdate() - INTERVAL DAYOFMONTH(curdate())-1 DAY - INTERVAL 1 month and\n curdate() - INTERVAL DAYOFMONTH(curdate()) DAY\n\tand status in ('CLOSED', 'MERGED', 'DECLINED')\n\tand pr.base_repo_id in ($repo_id)\n\n\n",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -590,7 +590,7 @@
"metricColumn": "none",
"queryType": "randomWalk",
"rawQuery": true,
"rawSql": "select\n 100 * sum(case when TIMESTAMPDIFF(Minute, created_date, closed_date) / 1440 < $prrt_sla then 1 else null end) / count(*)\nfrom \n\tpull_requests pr\nwhere \n date(created_date) BETWEEN\n curdate() - INTERVAL DAYOFMONTH(curdate())-1 DAY - INTERVAL 1 month and\n curdate() - INTERVAL DAYOFMONTH(curdate()) DAY\n\tand status in ('closed', 'merged', 'declined')\n\tand pr.base_repo_id in ($repo_id)\n\n\n",
"rawSql": "select\n 100 * sum(case when TIMESTAMPDIFF(Minute, created_date, closed_date) / 1440 < $prrt_sla then 1 else null end) / count(*)\nfrom \n\tpull_requests pr\nwhere \n date(created_date) BETWEEN\n curdate() - INTERVAL DAYOFMONTH(curdate())-1 DAY - INTERVAL 1 month and\n curdate() - INTERVAL DAYOFMONTH(curdate()) DAY\n\tand status in ('CLOSED', 'MERGED', 'DECLINED')\n\tand pr.base_repo_id in ($repo_id)\n\n\n",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -672,7 +672,7 @@
"metricColumn": "none",
"queryType": "randomWalk",
"rawQuery": true,
"rawSql": "select\n 100 * count(distinct case when status in ('closed', 'merged', 'declined') and merged_date is null then id else null end)/count(distinct case when status in ('closed', 'merged', 'declined') then id else null end) as ratio\nfrom \n\tpull_requests pr\nwhere\n date(created_date) BETWEEN\n curdate() - INTERVAL DAYOFMONTH(curdate())-1 DAY - INTERVAL 1 month and\n curdate() - INTERVAL DAYOFMONTH(curdate()) DAY\n and pr.base_repo_id in ($repo_id)",
"rawSql": "select\n 100 * count(distinct case when status in ('CLOSED', 'MERGED', 'DECLINED') and merged_date is null then id else null end)/count(distinct case when status in ('CLOSED', 'MERGED', 'DECLINED') then id else null end) as ratio\nfrom \n\tpull_requests pr\nwhere\n date(created_date) BETWEEN\n curdate() - INTERVAL DAYOFMONTH(curdate())-1 DAY - INTERVAL 1 month and\n curdate() - INTERVAL DAYOFMONTH(curdate()) DAY\n and pr.base_repo_id in ($repo_id)",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -828,5 +828,5 @@
"timezone": "",
"title": "Contributor Experience",
"uid": "bwsP5Nz4z",
"version": 6
"version": 9
}
12 changes: 6 additions & 6 deletions grafana/dashboards/DORA.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 3,
"id": 1,
"links": [
{
"asDropdown": false,
Expand Down Expand Up @@ -111,7 +111,7 @@
"metricColumn": "none",
"queryType": "randomWalk",
"rawQuery": true,
"rawSql": "with _requirements as(\n select \n DATE_ADD(date(resolution_date), INTERVAL -DAY(date(resolution_date))+1 DAY) as time,\n assignee_name as assignee,\n avg(lead_time_minutes)/1440 as lead_time\n from issues i\n where \n type = 'Requirement'\n and assignee_id != ''\n and $__timeFilter(resolution_date)\n group by 1,2\n),\n\n\nthis_month as(\n\tselect \n\t\tDATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY) as this_month\n),\n\nlast_month as(\n\tSELECT \n\t\tDATE_ADD(DATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY), INTERVAL -1 MONTH) as last_month\n),\n\nthe_month_before_last as(\n\tSELECT \n\t\tDATE_ADD(DATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY), INTERVAL -2 MONTH) as the_month_before_last\n),\n\nthis_month_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as this_month_count,\n\t\ttime as this_month\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT this_month from this_month)\n),\n\nlast_month_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as last_month_count,\n\t\ttime as last_month\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT last_month from last_month)\n),\n\nthe_month_before_last_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as the_month_before_last_count,\n\t\ttime as the_month_before_last\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT the_month_before_last from the_month_before_last)\n)\n\nSELECT\n COALESCE(NULLIF(tmr.assignee,''), NULLIF(lmr.assignee,''), tmblr.assignee) AS 'Assignee',\n\tCOALESCE(tmblr.the_month_before_last_count,0) AS \"The Month before Last\",\n\tCOALESCE(lmr.last_month_count,0) AS \"Last Month\",\n\tCOALESCE(tmr.this_month_count,0) AS \"This Month\",\n\tcase \n\t when lmr.last_month_count is null or tmr.this_month_count is null then '-'\n\t else concat(FORMAT(100 * (tmr.this_month_count - lmr.last_month_count)/lmr.last_month_count,1),'%') end as \"Changes in last 2 month\"\nFrom the_month_before_last_record tmblr \n left join last_month_record lmr on tmblr.assignee = lmr.assignee\n left join this_month_record tmr on tmblr.assignee = tmr.assignee\norder by 2",
"rawSql": "with _requirements as(\n select \n DATE_ADD(date(resolution_date), INTERVAL -DAY(date(resolution_date))+1 DAY) as time,\n assignee_name as assignee,\n avg(lead_time_minutes)/1440 as lead_time\n from issues i\n where \n type = 'REQUIREMENT'\n and assignee_id != ''\n and $__timeFilter(resolution_date)\n group by 1,2\n),\n\n\nthis_month as(\n\tselect \n\t\tDATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY) as this_month\n),\n\nlast_month as(\n\tSELECT \n\t\tDATE_ADD(DATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY), INTERVAL -1 MONTH) as last_month\n),\n\nthe_month_before_last as(\n\tSELECT \n\t\tDATE_ADD(DATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY), INTERVAL -2 MONTH) as the_month_before_last\n),\n\nthis_month_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as this_month_count,\n\t\ttime as this_month\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT this_month from this_month)\n),\n\nlast_month_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as last_month_count,\n\t\ttime as last_month\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT last_month from last_month)\n),\n\nthe_month_before_last_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as the_month_before_last_count,\n\t\ttime as the_month_before_last\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT the_month_before_last from the_month_before_last)\n)\n\nSELECT\n COALESCE(NULLIF(tmr.assignee,''), NULLIF(lmr.assignee,''), tmblr.assignee) AS 'Assignee',\n\tCOALESCE(tmblr.the_month_before_last_count,0) AS \"The Month before Last\",\n\tCOALESCE(lmr.last_month_count,0) AS \"Last Month\",\n\tCOALESCE(tmr.this_month_count,0) AS \"This Month\",\n\tcase \n\t when lmr.last_month_count is null or tmr.this_month_count is null then '-'\n\t else concat(FORMAT(100 * (tmr.this_month_count - lmr.last_month_count)/lmr.last_month_count,1),'%') end as \"Changes in last 2 month\"\nFrom the_month_before_last_record tmblr \n left join last_month_record lmr on tmblr.assignee = lmr.assignee\n left join this_month_record tmr on tmblr.assignee = tmr.assignee\norder by 2",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -182,7 +182,7 @@
"metricColumn": "none",
"queryType": "randomWalk",
"rawQuery": true,
"rawSql": "with _requirements as(\n select \n DATE_ADD(date(resolution_date), INTERVAL -DAY(date(resolution_date))+1 DAY) as time,\n assignee_name as assignee,\n avg(lead_time_minutes)/1440 as lead_time\n from issues i\n where \n type = 'Requirement'\n and assignee_id != ''\n and $__timeFilter(resolution_date)\n group by 1,2\n),\n\n\nthis_month as(\n\tselect \n\t\tDATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY) as this_month\n),\n\nlast_month as(\n\tSELECT \n\t\tDATE_ADD(DATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY), INTERVAL -1 MONTH) as last_month\n),\n\nthe_month_before_last as(\n\tSELECT \n\t\tDATE_ADD(DATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY), INTERVAL -2 MONTH) as the_month_before_last\n),\n\nthis_month_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as this_month_count,\n\t\ttime as this_month\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT this_month from this_month)\n),\n\nlast_month_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as last_month_count,\n\t\ttime as last_month\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT last_month from last_month)\n),\n\nthe_month_before_last_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as the_month_before_last_count,\n\t\ttime as the_month_before_last\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT the_month_before_last from the_month_before_last)\n)\n\nSELECT\n COALESCE(NULLIF(tmr.assignee,''), NULLIF(lmr.assignee,''), tmblr.assignee) AS 'Assignee',\n\tCOALESCE(tmblr.the_month_before_last_count,0) AS \"The Month before Last\",\n\tCOALESCE(lmr.last_month_count,0) AS \"Last Month\",\n\tCOALESCE(tmr.this_month_count,0) AS \"This Month\",\n\tcase \n\t when lmr.last_month_count is null or tmr.this_month_count is null then '-'\n\t else concat(FORMAT(100 * (tmr.this_month_count - lmr.last_month_count)/lmr.last_month_count,1),'%') end as \"Changes in last 2 month\"\nFrom the_month_before_last_record tmblr \n left join last_month_record lmr on tmblr.assignee = lmr.assignee\n left join this_month_record tmr on tmblr.assignee = tmr.assignee\norder by 2",
"rawSql": "with _requirements as(\n select \n DATE_ADD(date(resolution_date), INTERVAL -DAY(date(resolution_date))+1 DAY) as time,\n assignee_name as assignee,\n avg(lead_time_minutes)/1440 as lead_time\n from issues i\n where \n type = 'REQUIREMENT'\n and assignee_id != ''\n and $__timeFilter(resolution_date)\n group by 1,2\n),\n\n\nthis_month as(\n\tselect \n\t\tDATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY) as this_month\n),\n\nlast_month as(\n\tSELECT \n\t\tDATE_ADD(DATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY), INTERVAL -1 MONTH) as last_month\n),\n\nthe_month_before_last as(\n\tSELECT \n\t\tDATE_ADD(DATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY), INTERVAL -2 MONTH) as the_month_before_last\n),\n\nthis_month_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as this_month_count,\n\t\ttime as this_month\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT this_month from this_month)\n),\n\nlast_month_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as last_month_count,\n\t\ttime as last_month\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT last_month from last_month)\n),\n\nthe_month_before_last_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as the_month_before_last_count,\n\t\ttime as the_month_before_last\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT the_month_before_last from the_month_before_last)\n)\n\nSELECT\n COALESCE(NULLIF(tmr.assignee,''), NULLIF(lmr.assignee,''), tmblr.assignee) AS 'Assignee',\n\tCOALESCE(tmblr.the_month_before_last_count,0) AS \"The Month before Last\",\n\tCOALESCE(lmr.last_month_count,0) AS \"Last Month\",\n\tCOALESCE(tmr.this_month_count,0) AS \"This Month\",\n\tcase \n\t when lmr.last_month_count is null or tmr.this_month_count is null then '-'\n\t else concat(FORMAT(100 * (tmr.this_month_count - lmr.last_month_count)/lmr.last_month_count,1),'%') end as \"Changes in last 2 month\"\nFrom the_month_before_last_record tmblr \n left join last_month_record lmr on tmblr.assignee = lmr.assignee\n left join this_month_record tmr on tmblr.assignee = tmr.assignee\norder by 2",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -246,5 +246,5 @@
"timezone": "",
"title": "Demo-Average Requirement Lead Time By Assignee",
"uid": "q27fk7cnk",
"version": 2
"version": 6
}
4 changes: 2 additions & 2 deletions grafana/dashboards/DemoCommitCountByAuthor.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 4,
"id": 5,
"links": [
{
"asDropdown": false,
Expand Down Expand Up @@ -253,5 +253,5 @@
"timezone": "",
"title": "Demo-Commit Count by Author",
"uid": "F0iYknc7z",
"version": 2
"version": 3
}
8 changes: 4 additions & 4 deletions grafana/dashboards/DemoDetailedBugInfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 10,
"id": 2,
"links": [
{
"asDropdown": false,
Expand Down Expand Up @@ -114,7 +114,7 @@
"metricColumn": "none",
"queryType": "randomWalk",
"rawQuery": true,
"rawSql": "with bugs as(\n select \n DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY) as time,\n count(*) as bug_count\n from issues i\n where \n type = 'Bug'\n and $__timeFilter(created_date)\n group by 1\n order by 1 desc\n)\n\nselect\n date_format(time,'%M %Y') as month,\n bug_count as 'Bug Count over Month'\nfrom bugs\norder by time asc",
"rawSql": "with bugs as(\n select \n DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY) as time,\n count(*) as bug_count\n from issues i\n where \n type = 'BUG'\n and $__timeFilter(created_date)\n group by 1\n order by 1 desc\n)\n\nselect\n date_format(time,'%M %Y') as month,\n bug_count as 'Bug Count over Month'\nfrom bugs\norder by time asc",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -249,7 +249,7 @@
"metricColumn": "none",
"queryType": "randomWalk",
"rawQuery": true,
"rawSql": "select \n title,\n description,\n case when assignee_id = '' then '-' else assignee_name end as assignee,\n status,\n created_date,\n url\n from issues i\n where \n type = 'Bug'\n and $__timeFilter(created_date)\n order by created_date desc",
"rawSql": "select \n title,\n description,\n case when assignee_id = '' then '-' else assignee_name end as assignee,\n status,\n created_date,\n url\n from issues i\n where \n type = 'BUG'\n and $__timeFilter(created_date)\n order by created_date desc",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -311,5 +311,5 @@
"timezone": "",
"title": "Demo-Detailed Bug Info",
"uid": "s48Lzn5nz",
"version": 2
"version": 8
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "with _requirements as(\n select \n DATE_ADD(date(resolution_date), INTERVAL -DAY(date(resolution_date))+1 DAY) as time,\n avg(lead_time_minutes)/1440 as lead_time_days\n from issues i\n where \n type = 'Requirement'\n and $__timeFilter(resolution_date)\n group by time\n)\n\nselect\n date_format(time,'%M %Y') as month,\n lead_time_days as 'Average Requirement Lead Time (day)'\nfrom _requirements\norder by time asc",
"rawSql": "with _requirements as(\n select \n DATE_ADD(date(resolution_date), INTERVAL -DAY(date(resolution_date))+1 DAY) as time,\n avg(lead_time_minutes)/1440 as lead_time_days\n from issues i\n where \n type = 'REQUIREMENT'\n and $__timeFilter(resolution_date)\n group by time\n)\n\nselect\n date_format(time,'%M %Y') as month,\n lead_time_days as 'Average Requirement Lead Time (day)'\nfrom _requirements\norder by time asc",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -219,5 +219,5 @@
"timezone": "",
"title": "Demo-How fast do we respond to customer requirements?",
"uid": "SupYz7c7z",
"version": 2
"version": 4
}
4 changes: 2 additions & 2 deletions grafana/dashboards/DemoIsThisMonthMoreProductiveThanLast.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 5,
"id": 12,
"links": [
{
"asDropdown": false,
Expand Down Expand Up @@ -249,5 +249,5 @@
"timezone": "",
"title": "Demo-Is this month more productive than last?",
"uid": "ddREk75nk",
"version": 2
"version": 3
}
4 changes: 2 additions & 2 deletions grafana/dashboards/DemoWasOurQualityImprovedOrNot.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"metricColumn": "none",
"queryType": "randomWalk",
"rawQuery": true,
"rawSql": "with line_of_code as (\n\tselect \n\t DATE_ADD(date(authored_date), INTERVAL -DAY(date(authored_date))+1 DAY) as time,\n\t sum(additions + deletions) as line_count\n\tfrom \n\t commits\n\twhere \n\t message not like 'Merge%'\n\t and $__timeFilter(authored_date)\n\tgroup by 1\n),\n\n\nbug_count as(\n select \n DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY) as time,\n count(*) as bug_count\n from issues i\n where \n type = 'Bug'\n and $__timeFilter(created_date)\n group by 1\n),\n\n\nbug_count_per_1k_loc as(\n select \n loc.time,\n 1.0 * bc.bug_count / loc.line_count * 1000 as bug_count_per_1k_loc\n from \n line_of_code loc\n left join bug_count bc on bc.time = loc.time\n where\n bc.bug_count is not null \n and loc.line_count is not null \n and loc.line_count != 0\n)\n\nselect \n date_format(time,'%M %Y') as month,\n bug_count_per_1k_loc as 'Bug Count per 1000 Lines of Code'\nfrom bug_count_per_1k_loc \norder by time;",
"rawSql": "with line_of_code as (\n\tselect \n\t DATE_ADD(date(authored_date), INTERVAL -DAY(date(authored_date))+1 DAY) as time,\n\t sum(additions + deletions) as line_count\n\tfrom \n\t commits\n\twhere \n\t message not like 'Merge%'\n\t and $__timeFilter(authored_date)\n\tgroup by 1\n),\n\n\nbug_count as(\n select \n DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY) as time,\n count(*) as bug_count\n from issues i\n where \n type = 'BUG'\n and $__timeFilter(created_date)\n group by 1\n),\n\n\nbug_count_per_1k_loc as(\n select \n loc.time,\n 1.0 * bc.bug_count / loc.line_count * 1000 as bug_count_per_1k_loc\n from \n line_of_code loc\n left join bug_count bc on bc.time = loc.time\n where\n bc.bug_count is not null \n and loc.line_count is not null \n and loc.line_count != 0\n)\n\nselect \n date_format(time,'%M %Y') as month,\n bug_count_per_1k_loc as 'Bug Count per 1000 Lines of Code'\nfrom bug_count_per_1k_loc \norder by time;",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -216,5 +216,5 @@
"timezone": "",
"title": "Demo-Was our quality improved or not?",
"uid": "G4DEk75nz",
"version": 2
"version": 4
}
Loading

0 comments on commit ed29131

Please sign in to comment.