@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.
@@ -234,4 +234,38 @@ describe.each(runtimes.runtimeList)('%s', (databaseName, runtime) => {
234
234
  expect(row['capped']).not.toBe(null);
235
235
  }
236
236
  );
237
+
238
+ // Alaska's three facility types: 474 airports, 104 seaplane bases and 30
239
+ // heliports.
240
+ const alaskaByFacType = (nest: string) => `
241
+ run: ${databaseName}.table('malloytest.airports') -> {
242
+ where: state = 'AK'
243
+ group_by: state
244
+ nest: by_fac_type is { ${nest} }
245
+ }`;
246
+
247
+ // Counting a nest's elements reads each element's distinct key back out of
248
+ // the nest.
249
+ test.when(runtime.supportsNesting)(
250
+ `the elements of a nest can be counted in the next stage - ${databaseName}`,
251
+ async () => {
252
+ await expect(`
253
+ ${alaskaByFacType('group_by: fac_type; aggregate: c is count()')} -> {
254
+ aggregate:
255
+ fac_types is by_fac_type.count()
256
+ airports is by_fac_type.c.sum()
257
+ }`).toMatchResult(model, {fac_types: 3, airports: 608});
258
+ }
259
+ );
260
+
261
+ test.when(runtime.supportsNesting)(
262
+ `a boolean read back out of a nest is a boolean - ${databaseName}`,
263
+ async () => {
264
+ await expect(`
265
+ ${alaskaByFacType("group_by: fac_type, is_airport is fac_type = 'AIRPORT'")} -> {
266
+ where: by_fac_type.is_airport = true
267
+ group_by: by_fac_type.fac_type
268
+ }`).toEqualResult(model, [{fac_type: 'AIRPORT'}]);
269
+ }
270
+ );
237
271
  });
@@ -263,7 +263,11 @@ describe.each(runtimes.runtimeList)(
263
263
  aggregate: aircraft.aircraft_count
264
264
  aggregate: model_count
265
265
  }
266
- `).toMatchResult(joinTestModel, {model_count: 59104});
266
+ `).toMatchResult(joinTestModel, {
267
+ state: 'CA',
268
+ aircraft_count: 367,
269
+ model_count: 277,
270
+ });
267
271
  });
268
272
 
269
273
  it(`hand join symmetric agg - ${databaseName}`, async () => {
@@ -274,7 +278,7 @@ describe.each(runtimes.runtimeList)(
274
278
  }
275
279
  `).toMatchResult(joinTestModel, {
276
280
  total_seats: 452415,
277
- aircraft_count: 62644,
281
+ aircraft_count: 3599,
278
282
  });
279
283
  });
280
284
  }
@@ -90,7 +90,7 @@ describe('Wildcard BigQuery Tables', () => {
90
90
  {state: 'OK', aircraft_count: 1},
91
91
  {state: 'OR', aircraft_count: 2},
92
92
  {state: 'TX', aircraft_count: 1},
93
- {state: null, aircraft_count: 43},
93
+ {state: null, aircraft_count: 0},
94
94
  ]);
95
95
  }
96
96
  });
@@ -123,7 +123,7 @@ describe('Wildcard BigQuery Tables', () => {
123
123
  {state: 'LA', aircraft_count: 1},
124
124
  {state: 'OK', aircraft_count: 1},
125
125
  {state: 'OR', aircraft_count: 1},
126
- {state: null, aircraft_count: 47},
126
+ {state: null, aircraft_count: 0},
127
127
  ]);
128
128
  }
129
129
  });
@@ -180,7 +180,7 @@ describe('Wildcard BigQuery Tables', () => {
180
180
  .run();
181
181
  expect(result.data.value).toStrictEqual([
182
182
  {_TABLE_SUFFIX: '02', aircraft_count: 4},
183
- {_TABLE_SUFFIX: null, aircraft_count: 47},
183
+ {_TABLE_SUFFIX: null, aircraft_count: 0},
184
184
  ]);
185
185
  }
186
186
  });
package/src/runtimes.ts CHANGED
@@ -296,6 +296,7 @@ export function runtimeFor(dbName: string): SingleConnectionRuntime {
296
296
  token: process.env['DATABRICKS_TOKEN'],
297
297
  defaultCatalog: process.env['DATABRICKS_CATALOG'],
298
298
  defaultSchema: process.env['DATABRICKS_SCHEMA'],
299
+ proxy: process.env['DATABRICKS_HTTPS_PROXY'],
299
300
  });
300
301
  }
301
302
  break;