@malloydata/malloy-tests 0.0.167 → 0.0.168-dev240816212447
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.
|
|
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/render": "^0.0.
|
|
24
|
+
"@malloydata/db-bigquery": "^0.0.168-dev240816212447",
|
|
25
|
+
"@malloydata/db-duckdb": "^0.0.168-dev240816212447",
|
|
26
|
+
"@malloydata/db-postgres": "^0.0.168-dev240816212447",
|
|
27
|
+
"@malloydata/db-snowflake": "^0.0.168-dev240816212447",
|
|
28
|
+
"@malloydata/db-trino": "^0.0.168-dev240816212447",
|
|
29
|
+
"@malloydata/malloy": "^0.0.168-dev240816212447",
|
|
30
|
+
"@malloydata/render": "^0.0.168-dev240816212447",
|
|
31
31
|
"jsdom": "^22.1.0",
|
|
32
32
|
"luxon": "^2.4.0",
|
|
33
33
|
"madge": "^6.0.0"
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"@types/jsdom": "^21.1.1",
|
|
37
37
|
"@types/luxon": "^2.4.0"
|
|
38
38
|
},
|
|
39
|
-
"version": "0.0.
|
|
39
|
+
"version": "0.0.168-dev240816212447"
|
|
40
40
|
}
|
|
@@ -51,12 +51,23 @@ source: carriers is ${databaseName}.table('malloytest.carriers')
|
|
|
51
51
|
`;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const expressionModels = new Map<
|
|
54
|
+
const expressionModels = new Map<
|
|
55
|
+
string,
|
|
56
|
+
{
|
|
57
|
+
runtime: malloy.SingleConnectionRuntime;
|
|
58
|
+
expressionModel: malloy.ModelMaterializer;
|
|
59
|
+
}
|
|
60
|
+
>();
|
|
55
61
|
runtimes.runtimeMap.forEach((runtime, databaseName) =>
|
|
56
|
-
expressionModels.set(databaseName,
|
|
62
|
+
expressionModels.set(databaseName, {
|
|
63
|
+
runtime,
|
|
64
|
+
expressionModel: runtime.loadModel(modelText(databaseName)),
|
|
65
|
+
})
|
|
57
66
|
);
|
|
58
67
|
|
|
59
|
-
expressionModels.forEach((
|
|
68
|
+
expressionModels.forEach((x, databaseName) => {
|
|
69
|
+
const expressionModel = x.expressionModel;
|
|
70
|
+
const runtime = x.runtime;
|
|
60
71
|
const funcTestGeneral = async (
|
|
61
72
|
expr: string,
|
|
62
73
|
type: 'group_by' | 'aggregate',
|
|
@@ -1075,6 +1086,22 @@ expressionModels.forEach((expressionModel, databaseName) => {
|
|
|
1075
1086
|
expect(result.data.path(9, 'next_state').value).toBe('NONE');
|
|
1076
1087
|
});
|
|
1077
1088
|
});
|
|
1089
|
+
|
|
1090
|
+
describe('count_approx', () => {
|
|
1091
|
+
test.when(runtime.dialect.supportsCountApprox)(
|
|
1092
|
+
'works generally',
|
|
1093
|
+
async () => {
|
|
1094
|
+
await expect(`
|
|
1095
|
+
// be accurate within 10%
|
|
1096
|
+
// # test.debug
|
|
1097
|
+
run: ${databaseName}.table('malloytest.state_facts') -> {
|
|
1098
|
+
aggregate: x is round(count_approx(state)/10,0)*10
|
|
1099
|
+
aggregate: y is round(count_approx(airport_count)/10,0)*10
|
|
1100
|
+
}
|
|
1101
|
+
`).malloyResultMatches(runtime, {'x': 50, 'y': 50});
|
|
1102
|
+
}
|
|
1103
|
+
);
|
|
1104
|
+
});
|
|
1078
1105
|
describe('last_value', () => {
|
|
1079
1106
|
it(`works - ${databaseName}`, async () => {
|
|
1080
1107
|
const result = await expressionModel
|