Changeset 17586 for branches/2521_ProblemRefactoring/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/HiveStatistics
- Timestamp:
- 06/04/20 15:55:13 (5 years ago)
- Location:
- branches/2521_ProblemRefactoring
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring
- Property svn:mergeinfo changed
/trunk merged: 17574-17576,17579-17581,17583-17585
- Property svn:mergeinfo changed
-
branches/2521_ProblemRefactoring/HeuristicLab.Services.Hive.DataAccess
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Services.Hive.DataAccess merged: 17574
- Property svn:mergeinfo changed
-
branches/2521_ProblemRefactoring/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/HiveStatistics/DimJobDao.cs
r17226 r17586 44 44 } 45 45 46 public void UpdateExistingDimJobs() { 47 DataContext.ExecuteCommand(UpdateExistingDimJobsQuery); 48 } 49 46 50 #region Compiled queries 47 51 private static readonly Func<DataContext, Guid, DimJob> GetByIdQuery = … … 51 55 select dimJob).SingleOrDefault()); 52 56 #endregion 57 58 #region String queries 59 private const string UpdateExistingDimJobsQuery = @" 60 UPDATE u 61 SET 62 u.JobName = case when x.JobId is null then u.JobName else x.JobName end, 63 u.TotalTasks = x.TotalTasks, 64 u.CompletedTasks = x.CompletedTasks, 65 u.DateCompleted = 66 case when x.totaltasks = x.CompletedTasks 67 then (case when x.JobId is null and x.DateCompleted is null then GETDATE() else x.DateCompleted end) 68 else u.DateCompleted 69 end, 70 u.ProjectId = case when x.JobId is null then u.ProjectId else x.ProjectId end 71 FROM [statistics].dimjob u 72 JOIN ( 73 SELECT 74 dj.JobId as DimJobId, 75 j.JobId as JobId, 76 j.Name as JobName, 77 COUNT(*) as TotalTasks, 78 SUM( 79 CASE 80 WHEN TaskState in ('Finished', 'Aborted', 'Failed') then 1 81 ELSE 0 82 END) as CompletedTasks, 83 MAX(EndTime) as DateCompleted, 84 dp.ProjectId as ProjectId 85 from [statistics].DimJob dj 86 join [statistics].FactTask ft on dj.JobId = ft.JobId 87 left join Job j on j.JobId = dj.JobId 88 left join [statistics].DimProject dp on j.ProjectId = dp.ProjectId 89 where dj.DateCompleted is null and dp.DateExpired is null 90 group by dj.JobId, j.JobId, j.Name, dp.ProjectId 91 ) as x on u.JobId = x.DimJobId"; 92 #endregion 53 93 } 54 94 }
Note: See TracChangeset
for help on using the changeset viewer.