@malloydata/malloy-tests 0.0.307 → 0.0.309

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.307",
25
- "@malloydata/db-duckdb": "0.0.307",
26
- "@malloydata/db-postgres": "0.0.307",
27
- "@malloydata/db-snowflake": "0.0.307",
28
- "@malloydata/db-trino": "0.0.307",
29
- "@malloydata/malloy": "0.0.307",
30
- "@malloydata/malloy-tag": "0.0.307",
31
- "@malloydata/render": "0.0.307",
24
+ "@malloydata/db-bigquery": "0.0.309",
25
+ "@malloydata/db-duckdb": "0.0.309",
26
+ "@malloydata/db-postgres": "0.0.309",
27
+ "@malloydata/db-snowflake": "0.0.309",
28
+ "@malloydata/db-trino": "0.0.309",
29
+ "@malloydata/malloy": "0.0.309",
30
+ "@malloydata/malloy-tag": "0.0.309",
31
+ "@malloydata/render": "0.0.309",
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.307"
41
+ "version": "0.0.309"
42
42
  }
@@ -0,0 +1,21 @@
1
+ /*
2
+ * Copyright Contributors to the Malloy project
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import {runtimeFor} from '../runtimes';
7
+ import '../util/db-jest-matchers';
8
+
9
+ const runtime = runtimeFor('duckdb');
10
+
11
+ describe('misc tests for regressions that have no better home', () => {
12
+ test('rename a field in a join', async () => {
13
+ // Previously the rename would cause an error in the prepare step, so any result is good
14
+ await expect(`
15
+ source: carriers is duckdb.table('malloytest.carriers') extend { rename: airline is name }
16
+ run: duckdb.table('malloytest.flights') extend {
17
+ join_one: carriers on carrier = carriers.code
18
+ } -> { group_by: carriers.airline; limit: 1 }
19
+ `).malloyResultMatches(runtime, [{}]);
20
+ });
21
+ });
@@ -441,6 +441,20 @@ describe.each(runtimes.runtimeList)(
441
441
  }
442
442
  `).malloyResultMatches(runtime, {x: 'Mark'});
443
443
  });
444
+ test('record in join references join fields', async () => {
445
+ const id = quote('id');
446
+ const x = quote('x');
447
+ const y = quote('y');
448
+ await expect(`
449
+ source: joined_data is ${conName}.sql("""
450
+ SELECT 1 as ${id}, 10 as ${x}, 20 as ${y}
451
+ """) extend { dimension: rec is {xysum is x + y} }
452
+ source: base is ${conName}.sql("""SELECT 1 as ${id} """) extend {
453
+ join_one: jd is joined_data on jd.id = id
454
+ }
455
+ run: base -> { select: result is jd.rec.xysum }
456
+ `).malloyResultMatches(runtime, {result: 30});
457
+ });
444
458
  });
445
459
  describe('repeated record', () => {
446
460
  const abType: ArrayTypeDef = {
@@ -120,6 +120,19 @@ describe('Postgres tests', () => {
120
120
  ).malloyResultMatches(runtime, {abc: 'a', abc3: 'a3'});
121
121
  });
122
122
 
123
+ it('can compute symmetric aggregates on double precisions numbers', async () => {
124
+ await expect(`source: values is postgres.sql("""
125
+ SELECT 1::DOUBLE PRECISION as val, 1 as id
126
+ """) extend { measure: total_value is val.sum() }
127
+ source: thing is postgres.sql(""" SELECT 1 as id """) extend {
128
+ join_one: values on values.id = id
129
+ }
130
+ run: thing -> {
131
+ group_by: id
132
+ aggregate: tenx is 10 * values.total_value
133
+ }
134
+ `).malloyResultMatches(runtime, {tenx: 10});
135
+ });
123
136
  describe('time', () => {
124
137
  const zone = 'America/Mexico_City'; // -06:00 no DST
125
138
  const zone_2020 = DateTime.fromObject(