-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andreas Reichel <andreas@manticore-projects.com>
- Loading branch information
1 parent
ad7d932
commit 57d7464
Showing
4 changed files
with
227 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,26 @@ | ||
-- provided | ||
SELECT SAFE_CONVERT_BYTES_TO_STRING(b'\x61') as safe_convert | ||
; | ||
SELECT | ||
x, | ||
COUNTIF(x<0) OVER (ORDER BY ABS(x) ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS num_negative | ||
FROM UNNEST([5, -2, 3, 6, -10, NULL, -7, 4, 0]) AS x | ||
order by 1 NULLS FIRST; | ||
|
||
-- expected | ||
SELECT DECODE(COALESCE(TRY_CAST('\x61' AS BLOB),ENCODE('\x61')))AS SAFE_CONVERT; | ||
SELECT | ||
x, | ||
/* Approximation: Different NULL handling */ COUNT(IF(x < 0, x, NULL)) OVER (ORDER BY ABS(x) ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS num_negative | ||
FROM (SELECT UNNEST([5, -2, 3, 6, -10, NULL, -7, 4, 0]) AS x) AS x | ||
order by 1 NULLS FIRST; | ||
|
||
-- result | ||
"safe_convert" | ||
"a" | ||
"x","num_negative" | ||
"","1" | ||
"-10","2" | ||
"-7","2" | ||
"-2","1" | ||
"0","1" | ||
"3","1" | ||
"4","0" | ||
"5","0" | ||
"6","1" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters