Skip to content

Commit c688b53

Browse files
committed
fix: guard NULL population prior with coalesce fallback to 0 (IN-1249)
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
1 parent fdb2b46 commit c688b53

1 file changed

Lines changed: 21 additions & 12 deletions

File tree

services/libs/tinybird/pipes/health_score_v2.pipe

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,29 @@ DESCRIPTION >
3535
NODE population_priors
3636
SQL >
3737
SELECT
38-
(
39-
SELECT quantileExact(0.5)(maintainerHealthScoreV2 / 40.0)
40-
FROM health_score_v2_maintainer_ds
41-
WHERE maintainerHealthScoreV2 IS NOT NULL
38+
coalesce(
39+
(
40+
SELECT quantileExact(0.5)(maintainerHealthScoreV2 / 40.0)
41+
FROM health_score_v2_maintainer_ds
42+
WHERE maintainerHealthScoreV2 IS NOT NULL
43+
),
44+
0.0
4245
) AS priorMaintainerRate,
43-
(
44-
SELECT quantileExact(0.5)(securitySupplyChainScoreV2 / 35.0)
45-
FROM health_score_v2_security_ds
46-
WHERE securitySupplyChainScoreV2 IS NOT NULL
46+
coalesce(
47+
(
48+
SELECT quantileExact(0.5)(securitySupplyChainScoreV2 / 35.0)
49+
FROM health_score_v2_security_ds
50+
WHERE securitySupplyChainScoreV2 IS NOT NULL
51+
),
52+
0.0
4753
) AS priorSecurityRate,
48-
(
49-
SELECT quantileExact(0.5)(developmentActivityScoreV2 / 25.0)
50-
FROM health_score_v2_development_ds
51-
WHERE developmentActivityScoreV2 IS NOT NULL
54+
coalesce(
55+
(
56+
SELECT quantileExact(0.5)(developmentActivityScoreV2 / 25.0)
57+
FROM health_score_v2_development_ds
58+
WHERE developmentActivityScoreV2 IS NOT NULL
59+
),
60+
0.0
5261
) AS priorDevelopmentRate
5362

5463
NODE health_score_v2_results

0 commit comments

Comments
 (0)