@malloydata/malloy-tests 0.0.224-dev241217161218 → 0.0.224-dev241217193641

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,13 +21,13 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@jest/globals": "^29.4.3",
24
- "@malloydata/db-bigquery": "^0.0.224-dev241217161218",
25
- "@malloydata/db-duckdb": "^0.0.224-dev241217161218",
26
- "@malloydata/db-postgres": "^0.0.224-dev241217161218",
27
- "@malloydata/db-snowflake": "^0.0.224-dev241217161218",
28
- "@malloydata/db-trino": "^0.0.224-dev241217161218",
29
- "@malloydata/malloy": "^0.0.224-dev241217161218",
30
- "@malloydata/render": "^0.0.224-dev241217161218",
24
+ "@malloydata/db-bigquery": "^0.0.224-dev241217193641",
25
+ "@malloydata/db-duckdb": "^0.0.224-dev241217193641",
26
+ "@malloydata/db-postgres": "^0.0.224-dev241217193641",
27
+ "@malloydata/db-snowflake": "^0.0.224-dev241217193641",
28
+ "@malloydata/db-trino": "^0.0.224-dev241217193641",
29
+ "@malloydata/malloy": "^0.0.224-dev241217193641",
30
+ "@malloydata/render": "^0.0.224-dev241217193641",
31
31
  "events": "^3.3.0",
32
32
  "jsdom": "^22.1.0",
33
33
  "luxon": "^2.4.0",
@@ -37,5 +37,5 @@
37
37
  "@types/jsdom": "^21.1.1",
38
38
  "@types/luxon": "^2.4.0"
39
39
  },
40
- "version": "0.0.224-dev241217161218"
40
+ "version": "0.0.224-dev241217193641"
41
41
  }
@@ -24,6 +24,24 @@ describe.each(runtimes.runtimeList)('%s', (databaseName, runtime) => {
24
24
  run: x -> { group_by: foo }
25
25
  `).malloyResultMatches(runtime, {foo: 1});
26
26
  });
27
+ it('composite usage multistage', async () => {
28
+ await expect(`
29
+ ##! experimental.composite_sources
30
+ source: state_facts is ${databaseName}.table('malloytest.state_facts')
31
+ source: x is compose(state_facts, state_facts extend { dimension: foo is 1 })
32
+ run: x -> { group_by: foo } -> { select: foo }
33
+ `).malloyResultMatches(runtime, {foo: 1});
34
+ });
35
+ it('composite view multistage', async () => {
36
+ await expect(`
37
+ ##! experimental.composite_sources
38
+ source: state_facts is ${databaseName}.table('malloytest.state_facts')
39
+ source: x is compose(state_facts, state_facts extend { dimension: foo is 1 }) extend {
40
+ view: multistage is { group_by: foo } -> { select: foo }
41
+ }
42
+ run: x -> multistage
43
+ `).malloyResultMatches(runtime, {foo: 1});
44
+ });
27
45
  it('composite source used in join', async () => {
28
46
  await expect(`
29
47
  ##! experimental.composite_sources
@@ -307,4 +325,36 @@ describe.each(runtimes.runtimeList)('%s', (databaseName, runtime) => {
307
325
  run: x -> { group_by: state_facts.state }
308
326
  `).malloyResultMatches(runtime, {state: 'CA'});
309
327
  });
328
+ describe('index queries against composite sources', () => {
329
+ it('index query selects second input', async () => {
330
+ await expect(`
331
+ ##! experimental.composite_sources
332
+ source: state_facts is ${databaseName}.table('malloytest.state_facts')
333
+ run: compose(
334
+ state_facts,
335
+ state_facts extend { dimension: bar is 1 }
336
+ ) -> { index: bar }
337
+ `).malloyResultMatches(runtime, {}); // Just test that it runs
338
+ });
339
+ it('index query selects first input', async () => {
340
+ await expect(`
341
+ ##! experimental.composite_sources
342
+ source: state_facts is ${databaseName}.table('malloytest.state_facts')
343
+ run: compose(
344
+ state_facts extend { dimension: bar is 1 },
345
+ state_facts
346
+ ) -> { index: bar }
347
+ `).malloyResultMatches(runtime, {}); // Just test that it runs
348
+ });
349
+ it('index query resolves when two stages', async () => {
350
+ await expect(`
351
+ ##! experimental.composite_sources
352
+ source: state_facts is ${databaseName}.table('malloytest.state_facts')
353
+ run: compose(
354
+ state_facts extend { dimension: bar is 1 },
355
+ state_facts
356
+ ) -> { index: bar } -> { group_by: fieldName; where: fieldName != null }
357
+ `).malloyResultMatches(runtime, {fieldName: 'bar'});
358
+ });
359
+ });
310
360
  });