@malloydata/malloy-tests 0.0.206-dev241031153634 → 0.0.206-dev241031153949

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.206-dev241031153634",
25
- "@malloydata/db-duckdb": "^0.0.206-dev241031153634",
26
- "@malloydata/db-postgres": "^0.0.206-dev241031153634",
27
- "@malloydata/db-snowflake": "^0.0.206-dev241031153634",
28
- "@malloydata/db-trino": "^0.0.206-dev241031153634",
29
- "@malloydata/malloy": "^0.0.206-dev241031153634",
30
- "@malloydata/render": "^0.0.206-dev241031153634",
24
+ "@malloydata/db-bigquery": "^0.0.206-dev241031153949",
25
+ "@malloydata/db-duckdb": "^0.0.206-dev241031153949",
26
+ "@malloydata/db-postgres": "^0.0.206-dev241031153949",
27
+ "@malloydata/db-snowflake": "^0.0.206-dev241031153949",
28
+ "@malloydata/db-trino": "^0.0.206-dev241031153949",
29
+ "@malloydata/malloy": "^0.0.206-dev241031153949",
30
+ "@malloydata/render": "^0.0.206-dev241031153949",
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.206-dev241031153634"
40
+ "version": "0.0.206-dev241031153949"
41
41
  }
@@ -232,6 +232,46 @@ describe.each(runtimes.runtimeList)(
232
232
  m2 is min_by(y, x)
233
233
  }`).malloyResultMatches(runtime, {m1: 55, m2: 100});
234
234
  });
235
+
236
+ it(`runs the percent_rank function - ${databaseName}`, async () => {
237
+ await expect(`# debug
238
+ run: ${databaseName}.sql(
239
+ """
240
+ SELECT 55 as x
241
+ UNION ALL SELECT 22 as x
242
+ UNION ALL SELECT 1 as x
243
+ """
244
+ ) -> {
245
+ group_by: x
246
+ order_by: x desc
247
+ calculate: pctrnk is percent_rank()
248
+ }
249
+ `).malloyResultMatches(runtime, [
250
+ {x: 55, pctrnk: 0},
251
+ {x: 22, pctrnk: 0.5},
252
+ {x: 1, pctrnk: 1},
253
+ ]);
254
+ });
255
+
256
+ it(`runs the percent_rank function with order_by - ${databaseName}`, async () => {
257
+ await expect(`# debug
258
+ run: ${databaseName}.sql(
259
+ """
260
+ SELECT 55 as x
261
+ UNION ALL SELECT 22 as x
262
+ UNION ALL SELECT 1 as x
263
+ """
264
+ ) -> {
265
+ group_by: x
266
+ order_by: x desc
267
+ calculate: pctrnk is percent_rank() { order_by: x asc }
268
+ }
269
+ `).malloyResultMatches(runtime, [
270
+ {x: 55, pctrnk: 1},
271
+ {x: 22, pctrnk: 0.5},
272
+ {x: 1, pctrnk: 0},
273
+ ]);
274
+ });
235
275
  }
236
276
  );
237
277