PRAGMA WindowNewPipeline; $data = [ <|a: NULL, b: 1, sum: uint16('550'), count: 5|>, <|a: NULL, b: 1, sum: uint16('550'), count: 5|>, <|a: uint16('100'), b: 1, sum: uint16('550'), count: 5|>, <|a: uint16('200'), b: 1, sum: uint16('550'), count: 5|>, <|a: uint16('250'), b: 1, sum: uint16('550'), count: 5|>, ]; $win_result = ( SELECT SUM(a) OVER w1 AS actual_sum, COUNT(*) OVER w1 AS actual_count, sum, count, FROM AS_TABLE($data) WINDOW w1 AS ( PARTITION COMPACT BY b ORDER BY a ASC RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) ); $str = ($x) -> { return CAST($x as String) ?? "null"; }; SELECT Ensure(actual_sum, sum IS NOT DISTINCT FROM actual_sum, $str(actual_sum)), Ensure(actual_count, count IS NOT DISTINCT FROM actual_count, $str(actual_count)) FROM $win_result ;