@malloydata/malloy-tests 0.0.218-dev241120211046 → 0.0.218-dev241127170002
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.218-
|
|
25
|
-
"@malloydata/db-duckdb": "^0.0.218-
|
|
26
|
-
"@malloydata/db-postgres": "^0.0.218-
|
|
27
|
-
"@malloydata/db-snowflake": "^0.0.218-
|
|
28
|
-
"@malloydata/db-trino": "^0.0.218-
|
|
29
|
-
"@malloydata/malloy": "^0.0.218-
|
|
30
|
-
"@malloydata/render": "^0.0.218-
|
|
24
|
+
"@malloydata/db-bigquery": "^0.0.218-dev241127170002",
|
|
25
|
+
"@malloydata/db-duckdb": "^0.0.218-dev241127170002",
|
|
26
|
+
"@malloydata/db-postgres": "^0.0.218-dev241127170002",
|
|
27
|
+
"@malloydata/db-snowflake": "^0.0.218-dev241127170002",
|
|
28
|
+
"@malloydata/db-trino": "^0.0.218-dev241127170002",
|
|
29
|
+
"@malloydata/malloy": "^0.0.218-dev241127170002",
|
|
30
|
+
"@malloydata/render": "^0.0.218-dev241127170002",
|
|
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.218-
|
|
40
|
+
"version": "0.0.218-dev241127170002"
|
|
41
41
|
}
|
|
@@ -197,4 +197,15 @@ describe.each(runtimes.runtimeList)('%s', (databaseName, runtime) => {
|
|
|
197
197
|
}
|
|
198
198
|
`).malloyResultMatches(runtime, {x: 1});
|
|
199
199
|
});
|
|
200
|
+
it('reference composite field in nest', async () => {
|
|
201
|
+
await expect(`
|
|
202
|
+
##! experimental { composite_sources parameters }
|
|
203
|
+
source: state_facts is ${databaseName}.table('malloytest.state_facts')
|
|
204
|
+
run: compose(state_facts, state_facts extend { dimension: x is 1 }) -> {
|
|
205
|
+
nest: foo is {
|
|
206
|
+
group_by: x
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
`).malloyResultMatches(runtime, {'foo.x': 1});
|
|
210
|
+
});
|
|
200
211
|
});
|
|
@@ -1167,6 +1167,84 @@ SELECT row_to_json(finalStage) as row FROM __stage0 AS finalStage`);
|
|
|
1167
1167
|
}
|
|
1168
1168
|
);
|
|
1169
1169
|
|
|
1170
|
+
test.when(
|
|
1171
|
+
runtime.supportsNesting && runtime.dialect.supportsPipelinesInViews
|
|
1172
|
+
)(`Nested pipelines sort properly - ${databaseName}`, async () => {
|
|
1173
|
+
const result = await runtime
|
|
1174
|
+
.loadQuery(
|
|
1175
|
+
`
|
|
1176
|
+
source: state_facts is ${databaseName}.table('malloytest.state_facts')
|
|
1177
|
+
extend {
|
|
1178
|
+
view: base_view is {
|
|
1179
|
+
group_by: state
|
|
1180
|
+
aggregate: airports is sum(airport_count)
|
|
1181
|
+
order_by: airports asc
|
|
1182
|
+
}
|
|
1183
|
+
->
|
|
1184
|
+
{
|
|
1185
|
+
group_by: state
|
|
1186
|
+
aggregate: airports.sum()
|
|
1187
|
+
order_by: airports
|
|
1188
|
+
}
|
|
1189
|
+
view: base_view2 is {
|
|
1190
|
+
group_by: state
|
|
1191
|
+
aggregate: aircrafts is sum(aircraft_count)
|
|
1192
|
+
order_by: aircrafts asc
|
|
1193
|
+
}
|
|
1194
|
+
->
|
|
1195
|
+
{
|
|
1196
|
+
group_by: state
|
|
1197
|
+
aggregate: aircrafts.sum()
|
|
1198
|
+
order_by: aircrafts
|
|
1199
|
+
}
|
|
1200
|
+
view: base_view3 is {
|
|
1201
|
+
group_by: state
|
|
1202
|
+
aggregate: aircrafts is sum(aircraft_count)
|
|
1203
|
+
}
|
|
1204
|
+
-> {
|
|
1205
|
+
group_by: state
|
|
1206
|
+
aggregate: aircrafts.sum()
|
|
1207
|
+
}
|
|
1208
|
+
view: sort_issue is {
|
|
1209
|
+
where: popular_name ~ r'I'
|
|
1210
|
+
group_by: popular_name
|
|
1211
|
+
nest: base_view
|
|
1212
|
+
nest: base_view2
|
|
1213
|
+
nest: base_view3
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
run: state_facts -> sort_issue
|
|
1217
|
+
`
|
|
1218
|
+
)
|
|
1219
|
+
.run();
|
|
1220
|
+
console.log(result.sql);
|
|
1221
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1222
|
+
const d: any = result.data.toObject();
|
|
1223
|
+
const baseView: {state: string; airports: number}[] = d[0]['base_view'];
|
|
1224
|
+
console.log(baseView);
|
|
1225
|
+
let baseMax = baseView[0];
|
|
1226
|
+
for (const b of baseView) {
|
|
1227
|
+
expect(b.airports).toBeGreaterThanOrEqual(baseMax.airports);
|
|
1228
|
+
baseMax = b;
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
const baseView2: {state: string; aircrafts: number}[] = d[0]['base_view2'];
|
|
1232
|
+
console.log(baseView2);
|
|
1233
|
+
let baseMax2 = baseView2[0];
|
|
1234
|
+
for (const b of baseView2) {
|
|
1235
|
+
expect(b.aircrafts).toBeGreaterThanOrEqual(baseMax2.aircrafts);
|
|
1236
|
+
baseMax2 = b;
|
|
1237
|
+
}
|
|
1238
|
+
// implicit order by
|
|
1239
|
+
const baseView3: {state: string; aircrafts: number}[] = d[0]['base_view3'];
|
|
1240
|
+
console.log(baseView3);
|
|
1241
|
+
let baseMax3 = baseView3[0];
|
|
1242
|
+
for (const b of baseView3) {
|
|
1243
|
+
expect(b.aircrafts).toBeLessThanOrEqual(baseMax3.aircrafts);
|
|
1244
|
+
baseMax3 = b;
|
|
1245
|
+
}
|
|
1246
|
+
});
|
|
1247
|
+
|
|
1170
1248
|
test.when(runtime.supportsNesting)(
|
|
1171
1249
|
'number as null- ${databaseName}',
|
|
1172
1250
|
async () => {
|