@malloydata/malloy-tests 0.0.436 → 0.0.437
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
"malloyc": "ts-node ../scripts/malloy-to-json"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@malloydata/db-bigquery": "0.0.
|
|
24
|
-
"@malloydata/db-duckdb": "0.0.
|
|
25
|
-
"@malloydata/db-postgres": "0.0.
|
|
26
|
-
"@malloydata/db-snowflake": "0.0.
|
|
27
|
-
"@malloydata/db-sqlserver": "0.0.
|
|
28
|
-
"@malloydata/db-trino": "0.0.
|
|
29
|
-
"@malloydata/malloy": "0.0.
|
|
30
|
-
"@malloydata/malloy-tag": "0.0.
|
|
31
|
-
"@malloydata/render": "0.0.
|
|
32
|
-
"@malloydata/render-validator": "0.0.
|
|
23
|
+
"@malloydata/db-bigquery": "0.0.437",
|
|
24
|
+
"@malloydata/db-duckdb": "0.0.437",
|
|
25
|
+
"@malloydata/db-postgres": "0.0.437",
|
|
26
|
+
"@malloydata/db-snowflake": "0.0.437",
|
|
27
|
+
"@malloydata/db-sqlserver": "0.0.437",
|
|
28
|
+
"@malloydata/db-trino": "0.0.437",
|
|
29
|
+
"@malloydata/malloy": "0.0.437",
|
|
30
|
+
"@malloydata/malloy-tag": "0.0.437",
|
|
31
|
+
"@malloydata/render": "0.0.437",
|
|
32
|
+
"@malloydata/render-validator": "0.0.437",
|
|
33
33
|
"events": "^3.3.0",
|
|
34
34
|
"jsdom": "^22.1.0",
|
|
35
35
|
"luxon": "^3.7.2",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"overrides": {
|
|
44
44
|
"typescript": "^6.0.3"
|
|
45
45
|
},
|
|
46
|
-
"version": "0.0.
|
|
46
|
+
"version": "0.0.437"
|
|
47
47
|
}
|
package/src/core/bugless.spec.ts
CHANGED
|
@@ -21,6 +21,26 @@ describe('misc tests for regressions that have no better home', () => {
|
|
|
21
21
|
`).toMatchResult(testModel, {});
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
+
test('rename a field in a join below a filtered join', async () => {
|
|
25
|
+
// A filtered join becomes a subquery, and the joins below it are packed
|
|
26
|
+
// into a struct under their column names, which a rename leaves different
|
|
27
|
+
// from the name the query uses.
|
|
28
|
+
await expect(`
|
|
29
|
+
source: two is duckdb.sql("""SELECT 1 as k, 'acme' as name""") extend {
|
|
30
|
+
rename: two_k is k
|
|
31
|
+
primary_key: two_k
|
|
32
|
+
}
|
|
33
|
+
source: one is duckdb.sql("""SELECT 1 as k, 2 as j""") extend {
|
|
34
|
+
where: j > 0
|
|
35
|
+
join_one: two with k
|
|
36
|
+
}
|
|
37
|
+
source: zero is duckdb.sql("""SELECT 1 as k""") extend {
|
|
38
|
+
join_one: one on one.k = k
|
|
39
|
+
}
|
|
40
|
+
run: zero -> { group_by: one.two.name, one.two.two_k }
|
|
41
|
+
`).toMatchResult(testModel, {name: 'acme', two_k: 1});
|
|
42
|
+
});
|
|
43
|
+
|
|
24
44
|
test('ambiguous output names are auto-renamed and runnable', async () => {
|
|
25
45
|
// `state` and `s2.state` both want the name `state`; the second is renamed
|
|
26
46
|
// to `s2_state`. The query must compile to runnable SQL. (Small table with
|
|
@@ -116,6 +116,28 @@ describe('Postgres tests', () => {
|
|
|
116
116
|
}
|
|
117
117
|
`).toMatchResult(testModel, {tenx: 10});
|
|
118
118
|
});
|
|
119
|
+
it('keeps NUMERIC precision in symmetric aggregates', async () => {
|
|
120
|
+
// The join_many makes amt.sum() a symmetric aggregate. Its exact total,
|
|
121
|
+
// 1234567890123456.78, has more digits than a DOUBLE PRECISION holds; the
|
|
122
|
+
// second stage keeps only the cents, so the result fits in a JS number.
|
|
123
|
+
await expect(`
|
|
124
|
+
source: big is postgres.sql("""
|
|
125
|
+
SELECT 1 AS id, 1234567890123456.77::NUMERIC(18,2) AS amt
|
|
126
|
+
UNION ALL SELECT 2, 0.01
|
|
127
|
+
""") extend {
|
|
128
|
+
primary_key: id
|
|
129
|
+
join_many: dup is postgres.sql("""
|
|
130
|
+
SELECT 1 AS id UNION ALL SELECT 1 UNION ALL SELECT 2
|
|
131
|
+
""") on id = dup.id
|
|
132
|
+
}
|
|
133
|
+
run: big -> {
|
|
134
|
+
aggregate: total is amt.sum(), dup_rows is dup.count()
|
|
135
|
+
} -> {
|
|
136
|
+
select: cents is (total - 1234567890123456) * 100, dup_rows
|
|
137
|
+
}
|
|
138
|
+
`).toMatchResult(testModel, {cents: 78, dup_rows: 3});
|
|
139
|
+
});
|
|
140
|
+
|
|
119
141
|
describe('all-aggregates query with joins and nested views', () => {
|
|
120
142
|
// Reproduces a bug where an all-aggregates query on a source with
|
|
121
143
|
// joins and nested views throws on Postgres. Postgres simulates
|