Skip to content

Commit 85cc60e

Browse files
Merge fix/healthparser-interval-boundary-consistency into dev
2 parents 2f3544b + db7a0b8 commit 85cc60e

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

sp_HealthParser/sp_HealthParser.sql

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,15 +435,24 @@ AND ca.utc_timestamp < @end_date';
435435
END;
436436
ELSE
437437
BEGIN
438-
/* 2017+ handling */
438+
/*
439+
2017+ handling. Use the same half-open (>= @start_date AND
440+
< @end_date) shape as the pre-2017 branch so an event captured
441+
at exactly @end_date is not included on 2017+ while excluded
442+
on pre-2017 — previously BETWEEN meant a closed interval on
443+
2017+ and a row at the boundary could appear or not depending
444+
on which branch ran.
445+
*/
439446
SET @cross_apply = N'CROSS APPLY xml.{object_name}.nodes(''/event'') AS e(x)';
440447

441448
IF @timestamp_utc_mode = 1
442449
SET @time_filter = N'
443-
AND CONVERT(datetimeoffset(7), fx.timestamp_utc) BETWEEN @start_date AND @end_date';
450+
AND CONVERT(datetimeoffset(7), fx.timestamp_utc) >= @start_date
451+
AND CONVERT(datetimeoffset(7), fx.timestamp_utc) < @end_date';
444452
ELSE
445453
SET @time_filter = N'
446-
AND fx.timestamp_utc BETWEEN @start_date AND @end_date';
454+
AND fx.timestamp_utc >= @start_date
455+
AND fx.timestamp_utc < @end_date';
447456
END;
448457

449458
SET @sql_template =

0 commit comments

Comments
 (0)