volatilemolotov commented on code in PR #30327:
URL: https://github.com/apache/beam/pull/30327#discussion_r1494404705


##########
.test-infra/metrics/grafana/dashboards/GA-Post-Commits_status_dashboard.json:
##########
@@ -935,7 +935,7 @@
           "hide": false,
           "metricColumn": "none",
           "rawQuery": true,
-          "rawSql": "with workflows as (\n  select\n    *,\n    case when run1 
like 'success' then 1 when run1 like 'in_progress' then 2 when run1 like 
'queued' then 2 when run1 like 'waiting' then 2 when run1 like 'cancelled' then 
3 when run1 like 'None' then 4 else 0 end as run_1,\n    case when run2 like 
'success' then 1 when run2 like 'in_progress' then 2 when run2 like 'queued' 
then 2 when run2 like 'waiting' then 2 when run2 like 'cancelled' then 3 when 
run2 like 'None' then 4 else 0 end as run_2,\n    case when run3 like 'success' 
then 1 when run3 like 'in_progress' then 2 when run3 like 'queued' then 2 when 
run3 like 'waiting' then 2 when run3 like 'cancelled' then 3 when run3 like 
'None' then 4 else 0 end as run_3,\n    case when run4 like 'success' then 1 
when run4 like 'in_progress' then 2 when run4 like 'queued' then 2 when run4 
like 'waiting' then 2 when run4 like 'cancelled' then 3 when run4 like 'None' 
then 4 else 0 end as run_4,\n    case when run5 like 'success' the
 n 1 when run5 like 'in_progress' then 2 when run5 like 'queued' then 2 when 
run5 like 'waiting' then 2 when run5 like 'cancelled' then 3 when run5 like 
'None' then 4 else 0 end as run_5,\n    case when run6 like 'success' then 1 
when run6 like 'in_progress' then 2 when run6 like 'queued' then 2 when run6 
like 'waiting' then 2 when run6 like 'cancelled' then 3 when run6 like 'None' 
then 4 else 0 end as run_6,\n    case when run7 like 'success' then 1 when run7 
like 'in_progress' then 2 when run7 like 'queued' then 2 when run7 like 
'waiting' then 2 when run7 like 'cancelled' then 3 when run7 like 'None' then 4 
else 0 end as run_7,\n    case when run8 like 'success' then 1 when run8 like 
'in_progress' then 2 when run8 like 'queued' then 2 when run8 like 'waiting' 
then 2 when run8 like 'cancelled' then 3 when run8 like 'None' then 4 else 0 
end as run_8,\n    case when run9 like 'success' then 1 when run9 like 
'in_progress' then 2 when run9 like 'queued' then 2 when run9 like 'waiting' t
 hen 2 when run9 like 'cancelled' then 3 when run9 like 'None' then 4 else 0 
end as run_9,\n    case when run10 like 'success' then 1 when run10 like 
'in_progress' then 2 when run10 like 'queued' then 2 when run10 like 'waiting' 
then 2 when run10 like 'cancelled' then 3 when run10 like 'None' then 4 else 0 
end as run_10\n  from\n    github_workflows\n  where\n    dashboard_category = 
'core_infra'\n)\nselect\n  job_name,\n  job_yml_filename,\n  run_1,\n  
run1Id,\n  run_2,\n  run2Id,\n  run_3,\n  run3Id,\n  run_4,\n  run4Id,\n  
run_5,\n  run5Id,\n  run_6,\n  run6Id,\n  run_7,\n  run7Id,\n  run_8,\n  
run8Id,\n  run_9,\n  run9Id,\n  run_10,\n  run10Id\nfrom\n  workflows;",
+          "rawSql": "with workflows as (\n\twith temp as (SELECT 
t1.workflow_id, t1.job_name, t1.job_yml_filename, t1.dashboard_category, 
t1.run1, t2.run1id ,\nt1.run2, t2.run2id ,\nt1.run3, t2.run3id ,\nt1.run4, 
t2.run4id ,\nt1.run5, t2.run5id ,\nt1.run6, t2.run6id ,\nt1.run7, t2.run7id 
,\nt1.run8, t2.run8id ,\nt1.run9, t2.run9id ,\nt1.run10, t2.run10id \nFROM 
(SELECT * FROM crosstab('SELECT github_workflows_test.workflow_id, name, 
filename, dashboard_category, run_number, status \n                             
 FROM github_workflow_runs_test\nINNER JOIN github_workflows_test ON 
github_workflow_runs_test.workflow_id = 
github_workflows_test.workflow_id\nORDER BY 1,5 DESC\n','SELECT m from 
generate_series(1,10) m')\nAS c1(workflow_id text, job_name text, 
job_yml_filename text, dashboard_category text, run1 text, run2 text,run3 text, 
\n         run4 text ,run5 text,run6 text, run7 text, \n         run8 text 
,run9 text,run10 text) \n\t ) AS t1\n         JOIN (SELECT * FROM crosstab('SEL
 ECT name, status, github_workflow_runs_test.url AS run_url\nFROM 
github_workflow_runs_test\nINNER JOIN github_workflows_test ON 
github_workflow_runs_test.workflow_id = 
github_workflows_test.workflow_id\nORDER BY 1,3 DESC\n\n')\nAS c2(job_name 
text, run1id text, run2id text,run3id text, \n         run4id text ,run5id 
text,run6id text, run7id text, \n         run8id text ,run9id text,run10id 
text) \n\t\t\t  ) AS t2\n        ON t1.job_name = t2.job_name\n\t\t )\n  
select\n    *,\n    case when run1 like 'success' then 1 when run1 like 
'in_progress' then 2 when run1 like 'queued' then 2 when run1 like 'waiting' 
then 2 when run1 like 'cancelled' then 3 when run1 like 'failure' then 0 else 4 
end as run_1,\n    case when run2 like 'success' then 1 when run2 like 
'in_progress' then 2 when run2 like 'queued' then 2 when run2 like 'waiting' 
then 2 when run2 like 'cancelled' then 3 when run2 like 'failure' then 0 else 4 
end as run_2,\n    case when run3 like 'success' then 1 when run3 like 'in
 _progress' then 2 when run3 like 'queued' then 2 when run3 like 'waiting' then 
2 when run3 like 'cancelled' then 3 when run3 like 'failure' then 0 else 4 end 
as run_3,\n    case when run4 like 'success' then 1 when run4 like 
'in_progress' then 2 when run4 like 'queued' then 2 when run4 like 'waiting' 
then 2 when run4 like 'cancelled' then 3 when run4 like 'failure' then 0 else 4 
end as run_4,\n    case when run5 like 'success' then 1 when run5 like 
'in_progress' then 2 when run5 like 'queued' then 2 when run5 like 'waiting' 
then 2 when run5 like 'cancelled' then 3 when run5 like 'failure' then 0 else 4 
end as run_5,\n    case when run6 like 'success' then 1 when run6 like 
'in_progress' then 2 when run6 like 'queued' then 2 when run6 like 'waiting' 
then 2 when run6 like 'cancelled' then 3 when run6 like 'failure' then 0 else 4 
end as run_6,\n    case when run7 like 'success' then 1 when run7 like 
'in_progress' then 2 when run7 like 'queued' then 2 when run7 like 'waiting' 
then 2 when
  run7 like 'cancelled' then 3 when run7 like 'failure' then 0 else 4 end as 
run_7,\n    case when run8 like 'success' then 1 when run8 like 'in_progress' 
then 2 when run8 like 'queued' then 2 when run8 like 'waiting' then 2 when run8 
like 'cancelled' then 3 when run8 like 'failure' then 0 else 4 end as run_8,\n  
  case when run9 like 'success' then 1 when run9 like 'in_progress' then 2 when 
run9 like 'queued' then 2 when run9 like 'waiting' then 2 when run9 like 
'cancelled' then 3 when run9 like 'failure' then 0 else 4 end as run_9,\n    
case when run10 like 'success' then 1 when run10 like 'in_progress' then 2 when 
run10 like 'queued' then 2 when run10 like 'waiting' then 2 when run10 like 
'cancelled' then 3 when run10 like 'failure' then 0 else 4 end as run_10\n  
from\n    temp\n  where\n    dashboard_category = 'core_infra'\n)\nselect\n  
job_name,\n  job_yml_filename,\n  run_1,\n  run1Id,\n  run_2,\n  run2Id,\n  
run_3,\n  run3Id,\n  run_4,\n  run4Id,\n  run_5,\n  run5Id,\n  run_6
 ,\n  run6Id,\n  run_7,\n  run7Id,\n  run_8,\n  run8Id,\n  run_9,\n  run9Id,\n  
run_10,\n  run10Id\nfrom\n  workflows;",

Review Comment:
   Re 2: 
   Not sure which one you ask but in the first one most of the data is from 
`github_workflows_tests` so JOIN is needed. 
   
   Re 1: Done 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to