@malloydata/malloy-tests 0.0.302 → 0.0.304
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
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@jest/globals": "^29.4.3",
|
|
24
|
-
"@malloydata/db-bigquery": "0.0.
|
|
25
|
-
"@malloydata/db-duckdb": "0.0.
|
|
26
|
-
"@malloydata/db-postgres": "0.0.
|
|
27
|
-
"@malloydata/db-snowflake": "0.0.
|
|
28
|
-
"@malloydata/db-trino": "0.0.
|
|
29
|
-
"@malloydata/malloy": "0.0.
|
|
30
|
-
"@malloydata/malloy-tag": "0.0.
|
|
31
|
-
"@malloydata/render": "0.0.
|
|
24
|
+
"@malloydata/db-bigquery": "0.0.304",
|
|
25
|
+
"@malloydata/db-duckdb": "0.0.304",
|
|
26
|
+
"@malloydata/db-postgres": "0.0.304",
|
|
27
|
+
"@malloydata/db-snowflake": "0.0.304",
|
|
28
|
+
"@malloydata/db-trino": "0.0.304",
|
|
29
|
+
"@malloydata/malloy": "0.0.304",
|
|
30
|
+
"@malloydata/malloy-tag": "0.0.304",
|
|
31
|
+
"@malloydata/render": "0.0.304",
|
|
32
32
|
"events": "^3.3.0",
|
|
33
33
|
"jsdom": "^22.1.0",
|
|
34
34
|
"luxon": "^2.4.0",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"@types/jsdom": "^21.1.1",
|
|
39
39
|
"@types/luxon": "^2.4.0"
|
|
40
40
|
},
|
|
41
|
-
"version": "0.0.
|
|
41
|
+
"version": "0.0.304"
|
|
42
42
|
}
|
|
@@ -43,6 +43,16 @@ describe.each(runtimes.runtimeList)('%s', (databaseName, runtime) => {
|
|
|
43
43
|
run: x -> multistage
|
|
44
44
|
`).malloyResultMatches(runtime, {foo: 1});
|
|
45
45
|
});
|
|
46
|
+
it('SQL function contributes to field usage', async () => {
|
|
47
|
+
await expect(`
|
|
48
|
+
##! experimental {composite_sources sql_functions}
|
|
49
|
+
source: state_facts is ${databaseName}.table('malloytest.state_facts')
|
|
50
|
+
source: x is compose(state_facts, state_facts extend { dimension: foo is 1 }) extend {
|
|
51
|
+
dimension: foo_copy is sql_number('\${foo}')
|
|
52
|
+
}
|
|
53
|
+
run: x -> { group_by: foo_copy }
|
|
54
|
+
`).malloyResultMatches(runtime, {foo_copy: 1});
|
|
55
|
+
});
|
|
46
56
|
describe('composited joins', () => {
|
|
47
57
|
it('basic composited join', async () => {
|
|
48
58
|
await expect(`
|
|
@@ -559,6 +569,25 @@ describe.each(runtimes.runtimeList)('%s', (databaseName, runtime) => {
|
|
|
559
569
|
}
|
|
560
570
|
`).malloyResultMatches(runtime, {a_avg: 15, c: 2});
|
|
561
571
|
});
|
|
572
|
+
test('sql function contributes to partition composite selection', async () => {
|
|
573
|
+
await expect(`
|
|
574
|
+
##! experimental.sql_functions
|
|
575
|
+
#! experimental { partition_composite { partition_field=p partitions={a={a} b={b}} } }
|
|
576
|
+
source: comp is ${databaseName}.sql("""
|
|
577
|
+
SELECT 10 AS ${id('a')}, 0 AS ${id('b')}, 'a' AS ${id('p')}
|
|
578
|
+
UNION ALL SELECT 20 AS ${id('a')}, 0 AS ${id('b')}, 'a' AS ${id('p')}
|
|
579
|
+
UNION ALL SELECT 0 AS ${id('a')}, 1 AS ${id('b')}, 'b' AS ${id('p')}
|
|
580
|
+
UNION ALL SELECT 0 AS ${id('a')}, 2 AS ${id('b')}, 'b' AS ${id('p')}
|
|
581
|
+
""")
|
|
582
|
+
|
|
583
|
+
run: comp -> {
|
|
584
|
+
// a partition comes first, so it would be selected if there was no field usage
|
|
585
|
+
group_by: b_copy is sql_number('\${b}')
|
|
586
|
+
limit: 1
|
|
587
|
+
order_by: b_copy asc
|
|
588
|
+
}
|
|
589
|
+
`).malloyResultMatches(runtime, {b_copy: 1});
|
|
590
|
+
});
|
|
562
591
|
test('partition composite with fields different from partition name', async () => {
|
|
563
592
|
await expect(`
|
|
564
593
|
#! experimental { partition_composite { partition_field=p partitions={x={a} y={b}} } }
|