Skip to content

Commit 9cae0bd

Browse files
committed
Declare translation obligations for the forms that had none
Twenty-two forms carried no translation obligation, among them thirteen that counted as matching with nothing tying the figure to documented behaviour. Each now declares its documented obligations: - EXTRACT ... FROM, AVG, COUNT, NULLIF, TRY_TO_TIMESTAMP, GROUPING and GROUPING_ID land their recorded cases. EXTRACT moves from matching to refused through its TIMESTAMP_TZ case. - BOOLEAN, the INT and DOUBLE synonyms, TIME, TIMESTAMP, the ARRAY and OBJECT types and constants, element access and dollar-quoted strings await Snowflake receipts. - Obligations that cannot be met yet are held with their reason: cases that differ from Snowflake, refusals waiting on later conversion work, parse gaps, cases awaiting receipts, and GROUPING SETS, whose construct key form-links cannot name yet.
1 parent 297ddd0 commit 9cae0bd

11 files changed

Lines changed: 1557 additions & 1 deletion

File tree

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
category = "translation"
2+
construct = "sf.functions.avg.avg"
3+
session_profile = "utc-v1"
4+
5+
[[case]]
6+
id = "t001_number"
7+
description = "Integer groups whose average is not whole. Catches: integer division (1 instead of 1.666667)"
8+
columns = [{ name = "g", type = "VARCHAR" }, { name = "x", type = "NUMBER(38,0)" }]
9+
rows = [
10+
["'p'", "1"],
11+
["'q'", "7"],
12+
["'p'", "2"],
13+
["'p'", "2"],
14+
]
15+
query = "SELECT g, AVG(x) AS r FROM input GROUP BY g ORDER BY g"
16+
order = "ordered"
17+
tags = ["type-combination"]
18+
19+
[[case]]
20+
id = "t002_decimal"
21+
description = "Fixed-point values with two decimals. Catches: a FLOAT average or the input scale kept (2 digits instead of the widened scale)"
22+
columns = [{ name = "x", type = "NUMBER(10,2)" }]
23+
rows = [
24+
["1.25"],
25+
["2.50"],
26+
["0.01"],
27+
]
28+
query = "SELECT AVG(x) AS r FROM input"
29+
order = "ordered"
30+
tags = ["type-combination"]
31+
32+
[[case]]
33+
id = "t003_float"
34+
description = "Binary fractions that do not add exactly. Catches: a summation that differs from Snowflake's on these values (naive left-to-right gives 0.20000000000000004, exact or compensated 0.19999999999999998)"
35+
columns = [{ name = "x", type = "FLOAT" }]
36+
rows = [
37+
["0.1"],
38+
["0.2"],
39+
["0.3"],
40+
]
41+
query = "SELECT AVG(x) AS r FROM input"
42+
order = "ordered"
43+
tags = ["type-combination"]
44+
45+
[[case]]
46+
id = "t004_varchar"
47+
description = "Numeric text, which the page says is cast to FLOAT. Catches: text rejected, or read as NUMBER (a fixed-point result type)"
48+
columns = [{ name = "x", type = "VARCHAR" }]
49+
rows = [
50+
["'1.5'"],
51+
["'2'"],
52+
["'-0.25'"],
53+
]
54+
query = "SELECT AVG(x) AS r FROM input"
55+
order = "ordered"
56+
tags = ["type-combination"]
57+
58+
[[case]]
59+
id = "t006_null_expr1"
60+
description = "NULL rows beside values, and a group of only NULL. Catches: NULL read as 0 (a different average) or the all-NULL group giving 0"
61+
columns = [{ name = "g", type = "VARCHAR" }, { name = "x", type = "NUMBER(38,0)" }]
62+
rows = [
63+
["'p'", "NULL"],
64+
["'q'", "NULL"],
65+
["'p'", "4"],
66+
["'p'", "NULL"],
67+
["'p'", "1"],
68+
]
69+
query = "SELECT g, AVG(x) AS r FROM input GROUP BY g ORDER BY g"
70+
order = "ordered"
71+
tags = ["null"]
72+
73+
[[case]]
74+
id = "t007_empty_input"
75+
description = "No rows. Catches: an empty input giving 0 instead of NULL"
76+
columns = [{ name = "x", type = "NUMBER(38,0)" }]
77+
rows = [
78+
["5"],
79+
]
80+
query = "SELECT AVG(x) AS r FROM input WHERE ordinal < 0"
81+
order = "ordered"
82+
tags = ["empty-input"]
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
category = "translation"
2+
construct = "sf.functions.count.count"
3+
session_profile = "utc-v1"
4+
5+
[[case]]
6+
id = "t001_expr"
7+
description = "COUNT of a column with a NULL beside COUNT(*). Catches: COUNT(x) counting NULL rows, or COUNT(*) skipping them"
8+
columns = [{ name = "a", type = "NUMBER(38,0)" }, { name = "b", type = "VARCHAR" }]
9+
rows = [
10+
["1", "'x'"],
11+
["1", "'x'"],
12+
["1", "NULL"],
13+
["NULL", "'y'"],
14+
["2", "'x'"],
15+
]
16+
query = "SELECT COUNT(a) AS r, COUNT(*) AS star FROM input"
17+
order = "ordered"
18+
tags = ["type-combination"]
19+
20+
[[case]]
21+
id = "t002_multi"
22+
description = "COUNT(a, b), which skips a row where either is NULL. Catches: only the first column checked (4), or rows counted (5)"
23+
columns = [{ name = "a", type = "NUMBER(38,0)" }, { name = "b", type = "VARCHAR" }]
24+
rows = [
25+
["1", "'x'"],
26+
["1", "'x'"],
27+
["1", "NULL"],
28+
["NULL", "'y'"],
29+
["2", "'x'"],
30+
]
31+
query = "SELECT COUNT(a, b) AS r FROM input"
32+
order = "ordered"
33+
tags = ["type-combination"]
34+
35+
[[case]]
36+
id = "t003_distinct_multi"
37+
description = "DISTINCT over the combination with a repeated (1, x) pair. Catches: DISTINCT applied to the first column only (2 instead of 3), or rows with a NULL counted as a combination"
38+
columns = [{ name = "a", type = "NUMBER(38,0)" }, { name = "b", type = "VARCHAR" }]
39+
rows = [
40+
["1", "'x'"],
41+
["1", "'x'"],
42+
["1", "NULL"],
43+
["NULL", "'y'"],
44+
["2", "'x'"],
45+
["1", "'z'"],
46+
]
47+
query = "SELECT COUNT(DISTINCT a, b) AS r FROM input"
48+
order = "ordered"
49+
tags = ["duplicates"]
50+
51+
[[case]]
52+
id = "t007_null_expr1"
53+
description = "JSON null in a VARIANT beside SQL NULL and a value; the page says JSON null counts as NULL. Catches: JSON null counted as a value"
54+
columns = [{ name = "j", type = "VARCHAR" }]
55+
rows = [
56+
["'null'"],
57+
["NULL"],
58+
["'1'"],
59+
]
60+
query = "SELECT COUNT(PARSE_JSON(j)) AS r FROM input"
61+
order = "ordered"
62+
tags = ["null"]
63+
64+
[[case]]
65+
id = "t008_empty_input"
66+
description = "No rows. Catches: NULL instead of 0 for an empty input"
67+
columns = [{ name = "a", type = "NUMBER(38,0)" }]
68+
rows = [
69+
["1"],
70+
]
71+
query = "SELECT COUNT(a) AS r FROM input WHERE ordinal < 0"
72+
order = "ordered"
73+
tags = ["empty-input"]
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
category = "translation"
2+
construct = "sf.functions.extract.extract-from"
3+
session_profile = "utc-v1"
4+
5+
[[case]]
6+
id = "t001_date_parts"
7+
description = "Calendar and week parts of dates at year and ISO-week boundaries. Catches: dayofweek on another numbering, week by calendar year, or dayofyear 0-based, or ISO numbering for dayofweek (7 instead of 0 on the Sunday row)"
8+
columns = [{ name = "d", type = "DATE" }]
9+
rows = [
10+
["'2024-12-30'"],
11+
["'2021-01-01'"],
12+
["'2024-02-29'"],
13+
["'2023-01-01'"],
14+
]
15+
query = "SELECT EXTRACT(year FROM d) AS year, EXTRACT(quarter FROM d) AS quarter, EXTRACT(month FROM d) AS month, EXTRACT(day FROM d) AS day, EXTRACT(dayofweek FROM d) AS dayofweek, EXTRACT(dayofweekiso FROM d) AS dayofweekiso, EXTRACT(dayofyear FROM d) AS dayofyear, EXTRACT(week FROM d) AS week, EXTRACT(weekiso FROM d) AS weekiso, EXTRACT(yearofweekiso FROM d) AS yearofweekiso FROM input ORDER BY ordinal"
16+
order = "ordered"
17+
tags = ["type-combination"]
18+
19+
[[case]]
20+
id = "t002_time_parts"
21+
description = "Time parts with fractional seconds. Catches: seconds rounded, or nanosecond scaled to milliseconds"
22+
columns = [{ name = "t", type = "TIMESTAMP_NTZ" }]
23+
rows = [
24+
["'2024-02-29 13:07:59.123456789'"],
25+
["'1969-12-31 23:59:59.5'"],
26+
]
27+
query = "SELECT EXTRACT(hour FROM t) AS hour, EXTRACT(minute FROM t) AS minute, EXTRACT(second FROM t) AS second, EXTRACT(nanosecond FROM t) AS nanosecond, EXTRACT(epoch_second FROM t) AS epoch_second, EXTRACT(epoch_millisecond FROM t) AS epoch_millisecond FROM input ORDER BY ordinal"
28+
order = "ordered"
29+
tags = ["type-combination"]
30+
31+
[[case]]
32+
id = "t003_timestamp_tz"
33+
description = "Parts of a TIMESTAMP_TZ, including its offset and epoch. Catches: parts from the UTC instant instead of the wall clock, timezone_hour sign flipped, or epoch from the wall clock"
34+
columns = [{ name = "t", type = "TIMESTAMP_TZ" }]
35+
rows = [
36+
["'2024-12-31 23:30:00.250 -0800'"],
37+
["'2024-07-01 00:15:00 +0530'"],
38+
]
39+
query = "SELECT EXTRACT(year FROM t) AS year, EXTRACT(day FROM t) AS day, EXTRACT(hour FROM t) AS hour, EXTRACT(minute FROM t) AS minute, EXTRACT(timezone_hour FROM t) AS timezone_hour, EXTRACT(timezone_minute FROM t) AS timezone_minute, EXTRACT(epoch_second FROM t) AS epoch_second FROM input ORDER BY ordinal"
40+
order = "ordered"
41+
tags = ["type-combination"]
42+
43+
[[case]]
44+
id = "t004_time"
45+
description = "Parts of a TIME. Catches: an error for a TIME, or seconds rounded (46)"
46+
columns = [{ name = "t", type = "TIME" }]
47+
rows = [
48+
["'18:30:45.75'"],
49+
]
50+
query = "SELECT EXTRACT(hour FROM t) AS hour, EXTRACT(minute FROM t) AS minute, EXTRACT(second FROM t) AS second FROM input ORDER BY ordinal"
51+
order = "ordered"
52+
tags = ["type-combination"]
53+
54+
[[case]]
55+
id = "t006_null_date_interval_time_or_timestamp_expr"
56+
description = "NULL next to a set date. Catches: NULL read as a default date"
57+
columns = [{ name = "d", type = "DATE" }]
58+
rows = [
59+
["NULL"],
60+
["'2024-01-02'"],
61+
]
62+
query = "SELECT EXTRACT(year FROM d) AS year FROM input ORDER BY ordinal"
63+
order = "ordered"
64+
tags = ["null"]
65+
66+
[[case]]
67+
id = "t007_leap"
68+
description = "Day of year around 29 February. Catches: a 365-day year in 2024"
69+
columns = [{ name = "d", type = "DATE" }]
70+
rows = [
71+
["'2024-02-29'"],
72+
["'2024-12-31'"],
73+
["'2023-12-31'"],
74+
]
75+
query = "SELECT EXTRACT(dayofyear FROM d) AS dayofyear, EXTRACT(day FROM d) AS day FROM input ORDER BY ordinal"
76+
order = "ordered"
77+
tags = ["boundary"]
78+
79+
[[case]]
80+
id = "t008_pre_epoch"
81+
description = "Epoch parts before 1970. Catches: a truncation toward zero instead of floor for negative epochs"
82+
columns = [{ name = "t", type = "TIMESTAMP_NTZ" }]
83+
rows = [
84+
["'1969-12-31 23:59:59.900'"],
85+
["'1900-01-01 00:00:00'"],
86+
]
87+
query = "SELECT EXTRACT(epoch_second FROM t) AS epoch_second, EXTRACT(epoch_millisecond FROM t) AS epoch_millisecond FROM input ORDER BY ordinal"
88+
order = "ordered"
89+
tags = ["boundary"]
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
category = "translation"
2+
construct = "sf.functions.grouping-id"
3+
session_profile = "utc-v1"
4+
5+
[[case]]
6+
id = "t002_rollup"
7+
description = "ROLLUP (a, b) with three expressions in the call, not a palindrome. Catches: the bits reversed (the last expression most significant: 1 instead of 4)"
8+
columns = [{ name = "a", type = "NUMBER(38,0)" }, { name = "b", type = "VARCHAR" }, { name = "x", type = "NUMBER(38,0)" }]
9+
rows = [
10+
["1", "'u'", "5"],
11+
["1", "'v'", "7"],
12+
["NULL", "'u'", "2"],
13+
["2", "NULL", "1"],
14+
]
15+
query = "SELECT a, b, GROUPING_ID(b, a, a) AS r FROM input GROUP BY ROLLUP (a, b) ORDER BY r, a, b"
16+
order = "ordered"
17+
tags = ["type-combination"]
18+
19+
[[case]]
20+
id = "t003_cube"
21+
description = "CUBE (a, b). Catches: grouping read from NULL in the column"
22+
columns = [{ name = "a", type = "NUMBER(38,0)" }, { name = "b", type = "VARCHAR" }, { name = "x", type = "NUMBER(38,0)" }]
23+
rows = [
24+
["1", "'u'", "5"],
25+
["1", "'v'", "7"],
26+
["NULL", "'u'", "2"],
27+
["2", "NULL", "1"],
28+
]
29+
query = "SELECT a, b, GROUPING_ID(a, b) AS r FROM input GROUP BY CUBE (a, b) ORDER BY r, a, b"
30+
order = "ordered"
31+
tags = ["type-combination"]
32+
33+
[[case]]
34+
id = "t004_null_expr1"
35+
description = "A real NULL in the data next to the NULL of a super-aggregate row. Catches: the bit computed as \"column IS NULL\" (1 for the data row whose a is NULL)"
36+
columns = [{ name = "a", type = "NUMBER(38,0)" }, { name = "b", type = "VARCHAR" }, { name = "x", type = "NUMBER(38,0)" }]
37+
rows = [
38+
["1", "'u'", "5"],
39+
["1", "'v'", "7"],
40+
["NULL", "'u'", "2"],
41+
["2", "NULL", "1"],
42+
]
43+
query = "SELECT a, GROUPING_ID(a) AS r, COUNT(*) AS n FROM input GROUP BY ROLLUP (a) ORDER BY r, a"
44+
order = "ordered"
45+
tags = ["null"]
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
category = "translation"
2+
construct = "sf.functions.grouping"
3+
session_profile = "utc-v1"
4+
5+
[[case]]
6+
id = "t002_rollup"
7+
description = "ROLLUP (a, b) with three expressions in the call, not a palindrome. Catches: the bits reversed (the last expression most significant: 1 instead of 4)"
8+
columns = [{ name = "a", type = "NUMBER(38,0)" }, { name = "b", type = "VARCHAR" }, { name = "x", type = "NUMBER(38,0)" }]
9+
rows = [
10+
["1", "'u'", "5"],
11+
["1", "'v'", "7"],
12+
["NULL", "'u'", "2"],
13+
["2", "NULL", "1"],
14+
]
15+
query = "SELECT a, b, GROUPING(b, a, a) AS r FROM input GROUP BY ROLLUP (a, b) ORDER BY r, a, b"
16+
order = "ordered"
17+
tags = ["type-combination"]
18+
19+
[[case]]
20+
id = "t003_cube"
21+
description = "CUBE (a, b). Catches: grouping read from NULL in the column"
22+
columns = [{ name = "a", type = "NUMBER(38,0)" }, { name = "b", type = "VARCHAR" }, { name = "x", type = "NUMBER(38,0)" }]
23+
rows = [
24+
["1", "'u'", "5"],
25+
["1", "'v'", "7"],
26+
["NULL", "'u'", "2"],
27+
["2", "NULL", "1"],
28+
]
29+
query = "SELECT a, b, GROUPING(a, b) AS r FROM input GROUP BY CUBE (a, b) ORDER BY r, a, b"
30+
order = "ordered"
31+
tags = ["type-combination"]
32+
33+
[[case]]
34+
id = "t004_null_expr1"
35+
description = "A real NULL in the data next to the NULL of a super-aggregate row. Catches: the bit computed as \"column IS NULL\" (1 for the data row whose a is NULL)"
36+
columns = [{ name = "a", type = "NUMBER(38,0)" }, { name = "b", type = "VARCHAR" }, { name = "x", type = "NUMBER(38,0)" }]
37+
rows = [
38+
["1", "'u'", "5"],
39+
["1", "'v'", "7"],
40+
["NULL", "'u'", "2"],
41+
["2", "NULL", "1"],
42+
]
43+
query = "SELECT a, GROUPING(a) AS r, COUNT(*) AS n FROM input GROUP BY ROLLUP (a) ORDER BY r, a"
44+
order = "ordered"
45+
tags = ["null"]
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
category = "translation"
2+
construct = "sf.functions.nullif"
3+
session_profile = "utc-v1"
4+
5+
[[case]]
6+
id = "t001_number"
7+
description = "Equal and unequal values, across scales. Catches: expr2 returned, or scale compared"
8+
columns = [{ name = "a", type = "NUMBER(10,2)" }, { name = "b", type = "NUMBER(38,0)" }]
9+
rows = [
10+
["1.00", "1"],
11+
["2.50", "1"],
12+
]
13+
query = "SELECT NULLIF(a, b) AS r FROM input ORDER BY ordinal"
14+
order = "ordered"
15+
tags = ["type-combination"]
16+
17+
[[case]]
18+
id = "t002_varchar"
19+
description = "Strings differing only in case. Catches: case-insensitive equality"
20+
columns = [{ name = "a", type = "VARCHAR" }]
21+
rows = [
22+
["'A'"],
23+
["'a'"],
24+
]
25+
query = "SELECT NULLIF(a, 'a') AS r FROM input ORDER BY ordinal"
26+
order = "ordered"
27+
tags = ["type-combination"]
28+
29+
[[case]]
30+
id = "t004_null_expr2"
31+
description = "NULL second argument. Catches: NULL returned (NULL treated as equal)"
32+
columns = [{ name = "a", type = "NUMBER(38,0)" }]
33+
rows = [
34+
["3"],
35+
["NULL"],
36+
]
37+
query = "SELECT NULLIF(a, NULL) AS r FROM input ORDER BY ordinal"
38+
order = "ordered"
39+
tags = ["null"]

0 commit comments

Comments
 (0)