From 2e97e3305c7f50e0f3ef2385889e082017fe1dd8 Mon Sep 17 00:00:00 2001 From: Shuheng Liu Date: Mon, 4 Nov 2024 10:53:20 -0500 Subject: [PATCH] feat: improve SQL performance of MapRunCoverage --- CHANGELOG.md | 5 +++++ cls/TestCoverage/Data/Run.cls | 6 +++--- module.xml | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 027bea6..4c45fab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [4.0.5] - 2024-11-04 + +### Fixed +- #57: Improve SQL performance when mapping run coverage + ## [4.0.4] - 2024-10-15 ### Fixed diff --git a/cls/TestCoverage/Data/Run.cls b/cls/TestCoverage/Data/Run.cls index 1afd79d..1e7332f 100644 --- a/cls/TestCoverage/Data/Run.cls +++ b/cls/TestCoverage/Data/Run.cls @@ -128,11 +128,11 @@ ClassMethod MapRunCoverage(pRunIndex As %Integer) As %Status Set tSQLStatement = "INSERT OR UPDATE %NOLOCK %NOCHECK INTO TestCoverage_Data.Coverage_"_tMetric_" "_ "(Coverage,element_key,"_tMetric_") "_ "SELECT target.ID,map.ToLine,NVL(oldMetric."_tMetric_",0) + SUM(metric."_tMetric_") "_ - "FROM TestCoverage_Data.Coverage source "_ - "JOIN TestCoverage_Data.CodeUnitMap map "_ - " ON source.Hash = map.FromHash "_ + "FROM %INORDER TestCoverage_Data.Coverage source "_ "JOIN TestCoverage_Data.Coverage_"_tMetric_" metric "_ " ON metric.Coverage = source.ID "_ + "JOIN TestCoverage_Data.CodeUnitMap map "_ + " ON source.Hash = map.FromHash "_ " AND metric.element_key = map.FromLine "_ "JOIN TestCoverage_Data.Coverage target "_ " ON target.Run = source.Run "_ diff --git a/module.xml b/module.xml index 5e6d731..8cc4af1 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ TestCoverage - 4.0.4 + 4.0.5 Run your typical ObjectScript %UnitTest tests and see which lines of your code are executed. Includes Cobertura-style reporting for use in continuous integration tools. module