Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions cases/translation/functions/add-months.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,18 @@ rows = [
query = "SELECT ADD_MONTHS('2024-01-15'::DATE, n) AS r FROM input ORDER BY ordinal"
order = "ordered"
tags = ["boundary"]

[[case]]
id = "t008_negative_and_day_31"
description = "Negative counts from month ends and day 31 into shorter months, across a year. Catches: the month end lost going backwards, or day 31 overflowing into the next month"
columns = [{ name = "d", type = "DATE" }]
rows = [
["'2024-03-31'"],
["'2024-01-31'"],
["'2024-05-31'"],
["'2023-01-29'"],
["'2024-12-15'"],
]
query = "SELECT ADD_MONTHS(d, -1) AS m1, ADD_MONTHS(d, 1) AS p1, ADD_MONTHS(d, -13) AS m13 FROM input ORDER BY ordinal"
order = "ordered"
tags = ["type-combination"]
27 changes: 27 additions & 0 deletions cases/translation/functions/corr.corr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,30 @@ rows = [
query = "SELECT CORR(y, x) AS r FROM input WHERE ordinal < 0"
order = "ordered"
tags = ["empty-input"]

[[case]]
id = "t007_large_mean"
description = "Pairs near 1e9 with small spreads. Catches: a sum-of-products formula losing the digits of the spread"
columns = [{ name = "y", type = "NUMBER(38,0)" }, { name = "x", type = "NUMBER(38,0)" }]
rows = [
["1000000002", "1000000001"],
["1000000004", "1000000002"],
["1000000005", "1000000003"],
["1000000009", "1000000004"],
]
query = "SELECT CORR(y, x) AS r FROM input"
order = "ordered"
tags = ["type-combination"]

[[case]]
id = "t008_decimal"
description = "NUMBER(10,2) columns. Catches: the result type or scale of decimal inputs"
columns = [{ name = "y", type = "NUMBER(10,2)" }, { name = "x", type = "NUMBER(10,2)" }]
rows = [
["1.25", "2.50"],
["2.50", "2.75"],
["4.10", "3.00"],
]
query = "SELECT CORR(y, x) AS r, SYSTEM$TYPEOF(CORR(y, x)) AS t FROM input"
order = "ordered"
tags = ["type-combination"]
28 changes: 28 additions & 0 deletions cases/translation/functions/covar-pop.covar-pop.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,31 @@ rows = [
query = "SELECT COVAR_POP(y, x) AS r FROM input WHERE ordinal < 0"
order = "ordered"
tags = ["empty-input"]

[[case]]
id = "t006_large_mean"
description = "Pairs near 1e9 with small spreads. Catches: a sum-of-products formula losing the digits of the spread"
columns = [{ name = "y", type = "NUMBER(38,0)" }, { name = "x", type = "NUMBER(38,0)" }]
rows = [
["1000000002", "1000000001"],
["1000000004", "1000000002"],
["1000000005", "1000000003"],
["1000000009", "1000000004"],
]
query = "SELECT COVAR_POP(y, x) AS r FROM input"
order = "ordered"
expected_divergence = "float_sum_order"
tags = ["type-combination"]

[[case]]
id = "t007_decimal"
description = "NUMBER(10,2) columns. Catches: the result type or scale of decimal inputs"
columns = [{ name = "y", type = "NUMBER(10,2)" }, { name = "x", type = "NUMBER(10,2)" }]
rows = [
["1.25", "2.50"],
["2.50", "2.75"],
["4.10", "3.00"],
]
query = "SELECT COVAR_POP(y, x) AS r, SYSTEM$TYPEOF(COVAR_POP(y, x)) AS t FROM input"
order = "ordered"
tags = ["type-combination"]
28 changes: 28 additions & 0 deletions cases/translation/functions/covar-samp.covar-samp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,31 @@ rows = [
query = "SELECT COVAR_SAMP(y, x) AS r FROM input WHERE ordinal < 0"
order = "ordered"
tags = ["empty-input"]

[[case]]
id = "t006_large_mean"
description = "Pairs near 1e9 with small spreads. Catches: a sum-of-products formula losing the digits of the spread"
columns = [{ name = "y", type = "NUMBER(38,0)" }, { name = "x", type = "NUMBER(38,0)" }]
rows = [
["1000000002", "1000000001"],
["1000000004", "1000000002"],
["1000000005", "1000000003"],
["1000000009", "1000000004"],
]
query = "SELECT COVAR_SAMP(y, x) AS r FROM input"
order = "ordered"
expected_divergence = "float_sum_order"
tags = ["type-combination"]

[[case]]
id = "t007_decimal"
description = "NUMBER(10,2) columns. Catches: the result type or scale of decimal inputs"
columns = [{ name = "y", type = "NUMBER(10,2)" }, { name = "x", type = "NUMBER(10,2)" }]
rows = [
["1.25", "2.50"],
["2.50", "2.75"],
["4.10", "3.00"],
]
query = "SELECT COVAR_SAMP(y, x) AS r, SYSTEM$TYPEOF(COVAR_SAMP(y, x)) AS t FROM input"
order = "ordered"
tags = ["type-combination"]
26 changes: 26 additions & 0 deletions cases/translation/functions/months-between.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,29 @@ rows = [
query = "SELECT MONTHS_BETWEEN(a, b) AS r FROM input ORDER BY ordinal"
order = "ordered"
tags = ["boundary"]

[[case]]
id = "t008_month_ends_with_time"
description = "Timestamps on month ends and on equal days, with times of day. Catches: the time counted when both are month ends or share a day, or the fraction taken over the month length instead of 31 days"
columns = [{ name = "a", type = "TIMESTAMP_NTZ" }, { name = "b", type = "TIMESTAMP_NTZ" }]
rows = [
["'2019-03-31 23:00:00'", "'2019-02-28 01:00:00'"],
["'2024-04-30 00:00:00'", "'2024-03-30 12:00:00'"],
["'2024-01-31 06:00:00'", "'2024-02-29 18:00:00'"],
["'2024-01-10 06:00:00'", "'2024-02-20 18:00:00'"],
]
query = "SELECT MONTHS_BETWEEN(a, b) AS r FROM input ORDER BY ordinal"
order = "ordered"
tags = ["type-combination"]

[[case]]
id = "t009_long_negative"
description = "A span of years, negative. Catches: the whole months or the fraction miscounted far apart"
columns = [{ name = "a", type = "DATE" }, { name = "b", type = "DATE" }]
rows = [
["'2000-01-15'", "'2024-07-20'"],
["'2024-07-20'", "'1999-12-31'"],
]
query = "SELECT MONTHS_BETWEEN(a, b) AS r FROM input ORDER BY ordinal"
order = "ordered"
tags = ["type-combination"]
27 changes: 27 additions & 0 deletions cases/translation/functions/stddev-pop.stddev-pop.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,30 @@ rows = [
query = "SELECT STDDEV_POP(x) AS r FROM input WHERE ordinal < 0"
order = "ordered"
tags = ["empty-input"]

[[case]]
id = "t007_large_mean"
description = "Values near 1e9 with a spread of 1. Catches: a sum-of-squares formula losing the digits of the spread"
columns = [{ name = "x", type = "NUMBER(38,0)" }]
rows = [
["1000000001"],
["1000000002"],
["1000000003"],
["1000000004"],
]
query = "SELECT STDDEV_POP(x) AS r FROM input"
order = "ordered"
tags = ["type-combination"]

[[case]]
id = "t008_decimal"
description = "A NUMBER(10,2) column. Catches: the result type or scale of a decimal input"
columns = [{ name = "x", type = "NUMBER(10,2)" }]
rows = [
["1.25"],
["2.50"],
["4.10"],
]
query = "SELECT STDDEV_POP(x) AS r, SYSTEM$TYPEOF(STDDEV_POP(x)) AS t FROM input"
order = "ordered"
tags = ["type-combination"]
27 changes: 27 additions & 0 deletions cases/translation/functions/stddev.stddev-samp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,30 @@ rows = [
query = "SELECT STDDEV_SAMP(x) AS r FROM input WHERE ordinal < 0"
order = "ordered"
tags = ["empty-input"]

[[case]]
id = "t007_large_mean"
description = "Values near 1e9 with a spread of 1. Catches: a sum-of-squares formula losing the digits of the spread"
columns = [{ name = "x", type = "NUMBER(38,0)" }]
rows = [
["1000000001"],
["1000000002"],
["1000000003"],
["1000000004"],
]
query = "SELECT STDDEV_SAMP(x) AS r FROM input"
order = "ordered"
tags = ["type-combination"]

[[case]]
id = "t008_decimal"
description = "A NUMBER(10,2) column. Catches: the result type or scale of a decimal input"
columns = [{ name = "x", type = "NUMBER(10,2)" }]
rows = [
["1.25"],
["2.50"],
["4.10"],
]
query = "SELECT STDDEV_SAMP(x) AS r, SYSTEM$TYPEOF(STDDEV_SAMP(x)) AS t FROM input"
order = "ordered"
tags = ["type-combination"]
27 changes: 27 additions & 0 deletions cases/translation/functions/stddev.stddev.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,30 @@ rows = [
query = "SELECT STDDEV(x) AS r FROM input WHERE ordinal < 0"
order = "ordered"
tags = ["empty-input"]

[[case]]
id = "t007_large_mean"
description = "Values near 1e9 with a spread of 1. Catches: a sum-of-squares formula losing the digits of the spread"
columns = [{ name = "x", type = "NUMBER(38,0)" }]
rows = [
["1000000001"],
["1000000002"],
["1000000003"],
["1000000004"],
]
query = "SELECT STDDEV(x) AS r FROM input"
order = "ordered"
tags = ["type-combination"]

[[case]]
id = "t008_decimal"
description = "A NUMBER(10,2) column. Catches: the result type or scale of a decimal input"
columns = [{ name = "x", type = "NUMBER(10,2)" }]
rows = [
["1.25"],
["2.50"],
["4.10"],
]
query = "SELECT STDDEV(x) AS r, SYSTEM$TYPEOF(STDDEV(x)) AS t FROM input"
order = "ordered"
tags = ["type-combination"]
27 changes: 27 additions & 0 deletions cases/translation/functions/var-pop.var-pop.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,30 @@ rows = [
query = "SELECT VAR_POP(x) AS r FROM input WHERE ordinal < 0"
order = "ordered"
tags = ["empty-input"]

[[case]]
id = "t007_large_mean"
description = "Values near 1e9 with a spread of 1. Catches: a sum-of-squares formula losing the digits of the spread"
columns = [{ name = "x", type = "NUMBER(38,0)" }]
rows = [
["1000000001"],
["1000000002"],
["1000000003"],
["1000000004"],
]
query = "SELECT VAR_POP(x) AS r FROM input"
order = "ordered"
tags = ["type-combination"]

[[case]]
id = "t008_decimal"
description = "A NUMBER(10,2) column. Catches: the result type or scale of a decimal input"
columns = [{ name = "x", type = "NUMBER(10,2)" }]
rows = [
["1.25"],
["2.50"],
["4.10"],
]
query = "SELECT VAR_POP(x) AS r, SYSTEM$TYPEOF(VAR_POP(x)) AS t FROM input"
order = "ordered"
tags = ["type-combination"]
27 changes: 27 additions & 0 deletions cases/translation/functions/var-samp.var-samp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,30 @@ rows = [
query = "SELECT VAR_SAMP(x) AS r FROM input WHERE ordinal < 0"
order = "ordered"
tags = ["empty-input"]

[[case]]
id = "t007_large_mean"
description = "Values near 1e9 with a spread of 1. Catches: a sum-of-squares formula losing the digits of the spread"
columns = [{ name = "x", type = "NUMBER(38,0)" }]
rows = [
["1000000001"],
["1000000002"],
["1000000003"],
["1000000004"],
]
query = "SELECT VAR_SAMP(x) AS r FROM input"
order = "ordered"
tags = ["type-combination"]

[[case]]
id = "t008_decimal"
description = "A NUMBER(10,2) column. Catches: the result type or scale of a decimal input"
columns = [{ name = "x", type = "NUMBER(10,2)" }]
rows = [
["1.25"],
["2.50"],
["4.10"],
]
query = "SELECT VAR_SAMP(x) AS r, SYSTEM$TYPEOF(VAR_SAMP(x)) AS t FROM input"
order = "ordered"
tags = ["type-combination"]
27 changes: 27 additions & 0 deletions cases/translation/functions/variance-pop.variance-pop.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,30 @@ rows = [
query = "SELECT VARIANCE_POP(x) AS r FROM input WHERE ordinal < 0"
order = "ordered"
tags = ["empty-input"]

[[case]]
id = "t007_large_mean"
description = "Values near 1e9 with a spread of 1. Catches: a sum-of-squares formula losing the digits of the spread"
columns = [{ name = "x", type = "NUMBER(38,0)" }]
rows = [
["1000000001"],
["1000000002"],
["1000000003"],
["1000000004"],
]
query = "SELECT VARIANCE_POP(x) AS r FROM input"
order = "ordered"
tags = ["type-combination"]

[[case]]
id = "t008_decimal"
description = "A NUMBER(10,2) column. Catches: the result type or scale of a decimal input"
columns = [{ name = "x", type = "NUMBER(10,2)" }]
rows = [
["1.25"],
["2.50"],
["4.10"],
]
query = "SELECT VARIANCE_POP(x) AS r, SYSTEM$TYPEOF(VARIANCE_POP(x)) AS t FROM input"
order = "ordered"
tags = ["type-combination"]
Loading
Loading