"query": "WITH \n aparse(workflow_job.started_at, '*-*-*T*:*:*Z') AS (year1, month1, day1, hour1, minute1, second1) , \nnumeric(month1) - 1 as month1Num,floor((if(month1Num >= 2, numeric(year1), numeric(year1) - 1) - 1970)/4)* 24 * 60 * 60 as leaps1, \nif(month1Num = 1 ,31,\n if(month1Num = 2,59,\n if(month1Num = 3, 90,\n if(month1Num = 4,120,\n if(month1Num = 5,151, \n if(month1Num = 6,181,\n if(month1Num = 7,212,\n if(month1Num = 8,243,\n if(month1Num = 9,273,\n if(month1Num = 10,304,\n if(month1Num = 11,334,\n if(month1Num = 12,365, 0\n)))))))))))) as month1NumDays,\n((numeric(year1) - 1970) * 365 * 24 * 60 * 60) \n+ (month1NumDays * 24 * 60 * 60) \n+ (numeric(day1) - 1) * 24 * 60 * 60 \n+ ((numeric(hour1)) * 3600) \n+ (numeric(minute1)) * 60 \n+ numeric(second1) \n+ leaps1 as start_time, \n aparse(workflow_job.completed_at, '*-*-*T*:*:*Z') AS (year2, month2, day2, hour2, minute2, second2) , \nnumeric(month2) - 1 as month2Num,floor((if(month2Num >= 2, numeric(year2), numeric(year2) - 1) - 1970)/4)* 24 * 60 * 60 as leaps2, \nif(month2Num = 1 ,31,\n if(month2Num = 2,59,\n if(month2Num = 3, 90,\n if(month2Num = 4,120,\n if(month2Num = 5,151, \n if(month2Num = 6,181,\n if(month2Num = 7,212,\n if(month2Num = 8,243,\n if(month2Num = 9,273,\n if(month2Num = 10,304,\n if(month2Num = 11,334,\n if(month2Num = 12,365, 0\n)))))))))))) as month2NumDays,\n((numeric(year2) - 1970) * 365 * 24 * 60 * 60) \n+ (month2NumDays * 24 * 60 * 60) \n+ (numeric(day2) - 1) * 24 * 60 * 60 \n+ ((numeric(hour2)) * 3600) \n+ (numeric(minute2)) * 60 \n+ numeric(second2) \n+ leaps2 as finish_time\n\nSELECT average(finish_time-start_time)/60 FROM Log \nWHERE workflow_job.status = 'completed'\nFACET workflow_job.conclusion SINCE 1 MONTH AGO"
0 commit comments