@malloydata/malloy-tests 0.0.278 → 0.0.280
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.280",
|
|
25
|
+
"@malloydata/db-duckdb": "0.0.280",
|
|
26
|
+
"@malloydata/db-postgres": "0.0.280",
|
|
27
|
+
"@malloydata/db-snowflake": "0.0.280",
|
|
28
|
+
"@malloydata/db-trino": "0.0.280",
|
|
29
|
+
"@malloydata/malloy": "0.0.280",
|
|
30
|
+
"@malloydata/malloy-tag": "0.0.280",
|
|
31
|
+
"@malloydata/render": "0.0.280",
|
|
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.280"
|
|
42
42
|
}
|
|
@@ -459,6 +459,25 @@ expressionModels.forEach((x, databaseName) => {
|
|
|
459
459
|
expect(result.data.path(3, 'r').value).toBe(3);
|
|
460
460
|
});
|
|
461
461
|
|
|
462
|
+
it(`dense_rank is supported - ${databaseName}`, async () => {
|
|
463
|
+
const result = await expressionModel
|
|
464
|
+
.loadQuery(
|
|
465
|
+
` run: state_facts -> {
|
|
466
|
+
group_by:
|
|
467
|
+
first_letter is substr(state, 1, 1)
|
|
468
|
+
aggregate: state_count is count()
|
|
469
|
+
calculate: r is dense_rank() {order_by: state_count desc}
|
|
470
|
+
}`
|
|
471
|
+
)
|
|
472
|
+
.run();
|
|
473
|
+
// console.log(result.sql);
|
|
474
|
+
// console.log(result.data);
|
|
475
|
+
expect(result.data.path(0, 'r').value).toBe(1);
|
|
476
|
+
expect(result.data.path(1, 'r').value).toBe(1);
|
|
477
|
+
expect(result.data.path(2, 'r').value).toBe(2);
|
|
478
|
+
expect(result.data.path(3, 'r').value).toBe(2);
|
|
479
|
+
});
|
|
480
|
+
|
|
462
481
|
it(`works using unary minus in calculate block - ${databaseName}`, async () => {
|
|
463
482
|
const result = await expressionModel
|
|
464
483
|
.loadQuery(
|
|
@@ -345,6 +345,15 @@ describe.each(runtimes.runtimeList)(
|
|
|
345
345
|
}
|
|
346
346
|
`).malloyResultMatches(runtime, {some_words: ['hello', 'world']});
|
|
347
347
|
});
|
|
348
|
+
it('runs array_agg', async () => {
|
|
349
|
+
const onetwo = `${databaseName}.sql('SELECT 1 as "n" UNION ALL SELECT 2 UNION ALL SELECT 1')`;
|
|
350
|
+
await expect(`##! experimental
|
|
351
|
+
run: ${onetwo}->{aggregate: alln is array_agg(n) {order_by: n desc }}
|
|
352
|
+
`).matchesRows(runtime, {alln: [2, 1, 1]});
|
|
353
|
+
await expect(`##! experimental
|
|
354
|
+
run: ${onetwo}->{aggregate: alln is array_agg_distinct(n) {order_by:n asc}}
|
|
355
|
+
`).matchesRows(runtime, {alln: [1, 2]});
|
|
356
|
+
});
|
|
348
357
|
it.when(presto)('runs array_average', async () => {
|
|
349
358
|
await expect(
|
|
350
359
|
`run: ${nums}->{select: tavg is array_average(nums)}`
|