PRAGMA WindowNewPipeline; $data = [ <|a: Interval("P1D"), count: 2|>, <|a: Interval("P2D"), count: 3|>, <|a: Interval("P3D"), count: 2|>, <|a: Interval("P5D"), count: 2|>, <|a: Interval("P6D"), count: 2|>, ]; $win_result = ( SELECT COUNT(*) OVER w1 AS actual_count, count, FROM AS_TABLE($data) WINDOW w1 AS ( ORDER BY a ASC RANGE BETWEEN Interval64("P1DT12H") PRECEDING AND Interval64("P1D") FOLLOWING ) ); $str = ($x) -> { return CAST($x as String) ?? "null"; }; SELECT Ensure(actual_count, count IS NOT DISTINCT FROM actual_count, $str(actual_count)) FROM $win_result ;