@malloydata/malloy-tests 0.0.275 → 0.0.276

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.275",
25
- "@malloydata/db-duckdb": "0.0.275",
26
- "@malloydata/db-postgres": "0.0.275",
27
- "@malloydata/db-snowflake": "0.0.275",
28
- "@malloydata/db-trino": "0.0.275",
29
- "@malloydata/malloy": "0.0.275",
30
- "@malloydata/malloy-tag": "0.0.275",
31
- "@malloydata/render": "0.0.275",
24
+ "@malloydata/db-bigquery": "0.0.276",
25
+ "@malloydata/db-duckdb": "0.0.276",
26
+ "@malloydata/db-postgres": "0.0.276",
27
+ "@malloydata/db-snowflake": "0.0.276",
28
+ "@malloydata/db-trino": "0.0.276",
29
+ "@malloydata/malloy": "0.0.276",
30
+ "@malloydata/malloy-tag": "0.0.276",
31
+ "@malloydata/render": "0.0.276",
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.275"
41
+ "version": "0.0.276"
42
42
  }
@@ -43,6 +43,70 @@ describe.each(runtimes.runtimeList)('%s', (databaseName, runtime) => {
43
43
  run: x -> multistage
44
44
  `).malloyResultMatches(runtime, {foo: 1});
45
45
  });
46
+ describe('composited joins', () => {
47
+ it('basic composited join', async () => {
48
+ await expect(`
49
+ ##! experimental.composite_sources
50
+ source: state_facts is ${databaseName}.table('malloytest.state_facts')
51
+ source: s1 is state_facts extend {
52
+ join_one: j is state_facts extend {
53
+ dimension: f1 is 1
54
+ } on j.state = state
55
+ }
56
+ source: s2 is state_facts extend {
57
+ join_one: j is state_facts extend {
58
+ dimension: f2 is 2
59
+ } on j.state = state
60
+ }
61
+ source: c is compose(s1, s2)
62
+ run: c -> { group_by: j.f2 }
63
+ `).malloyResultMatches(runtime, {f2: 2});
64
+ });
65
+ it('selects correct join', async () => {
66
+ await expect(`
67
+ ##! experimental.composite_sources
68
+ source: state_facts is ${databaseName}.table('malloytest.state_facts')
69
+ source: s1 is state_facts extend {
70
+ join_one: j is state_facts extend {
71
+ dimension: jf is 1
72
+ } on true
73
+ dimension: f1 is 1
74
+ }
75
+ source: s2 is state_facts extend {
76
+ join_one: j is state_facts extend {
77
+ dimension: jf is 2
78
+ } on true
79
+ dimension: f2 is 2
80
+ }
81
+ source: c is compose(s1, s2)
82
+ run: c -> { group_by: j.jf, f2 }
83
+ `).malloyResultMatches(runtime, {f2: 2, jf: 2});
84
+ });
85
+ it('join on depends on selected join', async () => {
86
+ await expect(`
87
+ ##! experimental.composite_sources
88
+ source: state_facts is ${databaseName}.table('malloytest.state_facts')
89
+ source: jbase is compose(
90
+ state_facts extend {
91
+ dimension: jf1 is 1
92
+ },
93
+ state_facts extend {
94
+ dimension: jf2 is 2
95
+ }
96
+ )
97
+ source: s1 is state_facts extend {
98
+ join_one: j is jbase on j.jf1 = 1 and j.state = 'CA'
99
+ dimension: f1 is 1
100
+ }
101
+ source: s2 is state_facts extend {
102
+ join_one: j is jbase on j.jf2 = 2 and j.state = 'IL'
103
+ dimension: f2 is 2
104
+ }
105
+ source: c is compose(s1, s2)
106
+ run: c -> { group_by: j.jf2, f2, j.state }
107
+ `).malloyResultMatches(runtime, {jf2: 2, f2: 2, state: 'IL'});
108
+ });
109
+ });
46
110
  it('composite source used in join', async () => {
47
111
  await expect(`
48
112
  ##! experimental.composite_sources