@malloydata/malloy-tests 0.0.437 → 0.0.439

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/CONTEXT.md CHANGED
@@ -181,7 +181,7 @@ All cross-database tests (`test/src/databases/all/`) reference tables as `malloy
181
181
  | Trino/Presto | The hive connector reads the parquet in place: each file is mounted into the container and declared as an external table | `test/trino/hive_ddl.ts`, `test/trino/hive.properties`, `test/presto/hive.properties` | `trino_start.sh` / `presto_start.sh` derive the DDL from the parquet schemas at container start. The hive metastore lowercases names, so a table with nested columns (`ga_sample`) is a `_hive` table plus a view that casts the nested field names back; top-level column names stay lowercase, since Trino lowercases those in every connector |
182
182
  | BigQuery | Pre-loaded manually in `malloydata-org` project | (none) | No loader script in repo. Data assumed to exist. |
183
183
  | Snowflake | SQL: `PUT` local parquet → stage, `COPY INTO` table | `test/snowflake/load_test_data.sh` (wraps `load_test_data.sql`) | Run via `sh test/snowflake/load_test_data.sh` (needs the `snowsql` CLI) |
184
- | Databricks | TS script: upload to Volume via REST, `CREATE TABLE AS SELECT FROM read_files()` | `test/databricks/load_test_data.sh` (wraps `load_test_data.ts`) | Run manually with the `DATABRICKS_*` env vars set: `sh test/databricks/load_test_data.sh` |
184
+ | Databricks | TS script: upload to Volume via REST, `CREATE TABLE AS SELECT FROM read_files()` | `test/databricks/load_test_data.sh` (wraps `load_test_data.ts`) | Run manually with the `DATABRICKS_*` env vars set: `sh test/databricks/load_test_data.sh`. From a network that reaches the workspace only through a proxy, `DATABRICKS_HTTPS_PROXY` is the connection's `proxy` setting for the tests and `diag_databricks.ts`; the loader uploads with `fetch`, which does not use it |
185
185
 
186
186
  The DuckDB-driven loaders share `test/data/parquet_loader.ts`, which runs everything through Malloy's own `DuckDBConnection`, so a database is built by the same DuckDB the tests read it with. It reads the table list from the parquet directory and takes a `LoadPlan` naming what a target cannot hold.
187
187
 
@@ -17,6 +17,7 @@ async function main() {
17
17
  token: process.env['DATABRICKS_TOKEN'],
18
18
  defaultCatalog: process.env['DATABRICKS_CATALOG'],
19
19
  defaultSchema: process.env['DATABRICKS_SCHEMA'],
20
+ proxy: process.env['DATABRICKS_HTTPS_PROXY'],
20
21
  });
21
22
 
22
23
  const sql = process.argv[2];
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.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",
23
+ "@malloydata/db-bigquery": "0.0.439",
24
+ "@malloydata/db-duckdb": "0.0.439",
25
+ "@malloydata/db-postgres": "0.0.439",
26
+ "@malloydata/db-snowflake": "0.0.439",
27
+ "@malloydata/db-sqlserver": "0.0.439",
28
+ "@malloydata/db-trino": "0.0.439",
29
+ "@malloydata/malloy": "0.0.439",
30
+ "@malloydata/malloy-tag": "0.0.439",
31
+ "@malloydata/render": "0.0.439",
32
+ "@malloydata/render-validator": "0.0.439",
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.437"
46
+ "version": "0.0.439"
47
47
  }
@@ -13,7 +13,7 @@ DATADIR=$ROOTDIR/test/data/malloytest-parquet
13
13
  PRESTO_VERSION=0.287
14
14
  USE_SLIM=false
15
15
  CONTAINER_NAME="presto-malloy"
16
- PORT=${PRESTO_PORT:-8080}
16
+ PORT=${PRESTO_PORT:-8090}
17
17
 
18
18
  # Parse arguments
19
19
  for arg in "$@"; do
@@ -46,6 +46,31 @@ describe('givens — runtime supply path (Stage 4)', () => {
46
46
  expect(result.data.toObject().length).toBe(1);
47
47
  });
48
48
 
49
+ test('a supplied negative number keeps its sign beside a minus', async () => {
50
+ const model = runtime.loadModel(`
51
+ ##! experimental.givens
52
+ given: NEG :: number
53
+ query: q is duckdb.sql("SELECT 2 as c") -> { select: x is c - $NEG }
54
+ `);
55
+ const result = await model.loadQueryByName('q').run({givens: {NEG: -5}});
56
+ expect(result.data.path(0, 'x').value).toBe(7);
57
+ });
58
+
59
+ test('membership in a supplied array is one term of a comparison', async () => {
60
+ const model = runtime.loadModel(`
61
+ ##! experimental.givens
62
+ given: ARR :: number[]
63
+ query: q is duckdb.sql("SELECT 2 as c, true as t") -> {
64
+ select: x is c in $ARR = t
65
+ }
66
+ `);
67
+ const q = model.loadQueryByName('q');
68
+ const sql = await q.getSQL({givens: {ARR: [2, -2]}});
69
+ expect(sql).toMatch(/\(base\."c" IN \(2,-2\)\)=base\."t"/);
70
+ const result = await q.run({givens: {ARR: [2, -2]}});
71
+ expect(result.data.path(0, 'x').value).toBe(true);
72
+ });
73
+
49
74
  test('number given drives a where comparison', async () => {
50
75
  const model = runtime.loadModel(`
51
76
  ##! experimental.givens
@@ -211,10 +236,9 @@ describe('givens — runtime supply path (Stage 4)', () => {
211
236
  expect(rSp.data.path(0, 'ct').value).toBe(1);
212
237
  });
213
238
 
214
- test('date-literal default morphs to timestamp and filters flights.dep_time', async () => {
215
- // Exercises the morphic default path in define-given: the declared
216
- // type is `timestamp`, the default `@2003-01-01` is a date literal,
217
- // and the AST converts it to a timestamp expression so the default
239
+ test('date-literal default is a timestamp and filters flights.dep_time', async () => {
240
+ // The declared type is `timestamp` and the default `@2003-01-01` is a
241
+ // date literal, so the default is the literal's timestamp reading and
218
242
  // can drive a timestamp-column comparison at runtime.
219
243
  const model = runtime.loadModel(`
220
244
  ##! experimental.givens