Skip to content

Commit 6890995

Browse files
fix presto/trin split
1 parent 6b39dfe commit 6890995

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

packages/malloy/src/dialect/trino/dialect_functions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ function define(
389389

390390
define('array_distinct', {x: {array: T}}, {array: T});
391391
define('array_except', {x: {array: T}, y: {array: T}}, {array: T});
392+
define('array_intersect', {x: {array: T}, y: {array: T}}, {array: T});
392393
define('array_max', {x: {array: T}}, T);
393394
define('array_min', {x: {array: T}}, T);
394395
define('array_normalize', {x: {array: T}, p: 'number'}, {array: T});

test/src/databases/presto-trino/presto-trino.spec.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ describe.each(runtimes.runtimeList)(
2121
if (runtime === undefined) {
2222
throw new Error("Couldn't build runtime");
2323
}
24+
const presto = databaseName === 'presto';
2425

2526
it(`runs an sql query - ${databaseName}`, async () => {
2627
await expect(
@@ -325,7 +326,7 @@ describe.each(runtimes.runtimeList)(
325326
}
326327
`).malloyResultMatches(runtime, {some_words: ['hello', 'world']});
327328
});
328-
it('runs array_average', async () => {
329+
it.when(presto)('runs array_average', async () => {
329330
await expect(
330331
`run: ${nums}->{select: tavg is array_average(nums)}`
331332
).malloyResultMatches(runtime, {tavg: 2});
@@ -335,7 +336,7 @@ describe.each(runtimes.runtimeList)(
335336
`run: ${nums}->{select: t is array_distinct(nums)}`
336337
).malloyResultMatches(runtime, {t: [4, 1]});
337338
});
338-
it('runs array_has_duplicates', async () => {
339+
it.when(presto)('runs array_has_duplicates', async () => {
339340
await expect(
340341
`run: ${nums}->{select: t is array_has_duplicates(nums)}`
341342
).malloyResultMatches(runtime, {t: true});
@@ -350,12 +351,12 @@ describe.each(runtimes.runtimeList)(
350351
`run: ${nums}->{select: t is array_min(nums)}`
351352
).malloyResultMatches(runtime, {t: 1});
352353
});
353-
it('runs array_cum_sum', async () => {
354+
it.when(presto)('runs array_cum_sum', async () => {
354355
await expect(
355356
`run: ${nums}->{select: t is array_cum_sum(nums)}`
356357
).malloyResultMatches(runtime, {t: [4, 5, 6]});
357358
});
358-
it('runs array_duplicates', async () => {
359+
it.when(presto)('runs array_duplicates', async () => {
359360
await expect(
360361
`run: ${nums}->{select: t is array_duplicates(nums)}`
361362
).malloyResultMatches(runtime, {t: [1]});
@@ -380,7 +381,7 @@ describe.each(runtimes.runtimeList)(
380381
`run: ${nums}->{select: t is cardinality(nums)}`
381382
).malloyResultMatches(runtime, {t: 3});
382383
});
383-
it('runs array_sum', async () => {
384+
it.when(presto)('runs array_sum', async () => {
384385
await expect(
385386
`run: ${nums}->{select: t is array_sum(nums)}`
386387
).malloyResultMatches(runtime, {t: 6});
@@ -402,7 +403,7 @@ describe.each(runtimes.runtimeList)(
402403
run: ${nums}->{select: t is array_normalize(nums, 40)}
403404
`).malloyResultMatches(runtime, {t: [1, 0.25, 0.25]});
404405
});
405-
it('runs array_position', async () => {
406+
it.when(presto)('runs array_position', async () => {
406407
await expect(
407408
`run: ${nums}->{select: t is array_position(nums, 1, 2)}`
408409
).malloyResultMatches(runtime, {t: 3});
@@ -412,7 +413,7 @@ describe.each(runtimes.runtimeList)(
412413
`run: ${nums}->{select: t is array_remove(nums, 1)}`
413414
).malloyResultMatches(runtime, {t: [4]});
414415
});
415-
it('runs array_sort_desc', async () => {
416+
it.when(presto)('runs array_sort_desc', async () => {
416417
await expect(
417418
`run: ${nums}->{select: t is array_sort_desc([1,2,3])}`
418419
).malloyResultMatches(runtime, {t: [3, 2, 1]});
@@ -433,12 +434,13 @@ describe.each(runtimes.runtimeList)(
433434
`run: ${nums}->{select: t is array_union(nums, [2])}`
434435
).malloyResultMatches(runtime, {t: [4, 1, 2]});
435436
});
436-
it('runs remove_nulls', async () => {
437+
it.when(presto)('runs remove_nulls', async () => {
437438
await expect(
438439
`run: ${nums}->{select: t is remove_nulls([null, 2])}`
439440
).malloyResultMatches(runtime, {t: [2]});
440441
});
441-
it('runs reverse', async () => {
442+
/// mtoy todo figure out overload
443+
it.skip('runs reverse', async () => {
442444
await expect(
443445
`run: ${nums}->{select: t is reverse(nums)}`
444446
).malloyResultMatches(runtime, {t: [1, 1, 4]});
@@ -448,7 +450,7 @@ describe.each(runtimes.runtimeList)(
448450
`run: ${nums}->{select: t is shuffle([1])}`
449451
).malloyResultMatches(runtime, {t: [1]});
450452
});
451-
it('runs array_top_n', async () => {
453+
it.when(presto)('runs array_top_n', async () => {
452454
await expect(
453455
`run: ${nums}->{select: t is array_top_n(nums, 2)}`
454456
).malloyResultMatches(runtime, {t: [4, 1]});
@@ -512,7 +514,7 @@ describe.each(runtimes.runtimeList)(
512514
`run: ${nums}->{select: t is array_intersect(nums, [4])}`
513515
).malloyResultMatches(runtime, {t: [4]});
514516
});
515-
it('runs array_intersect(a)', async () => {
517+
it.when(presto)('runs array_intersect(a)', async () => {
516518
await expect(
517519
`run: ${nums}->{select: t is array_intersect([[1,2], [2,3]])}`
518520
).malloyResultMatches(runtime, {t: [2]});
@@ -527,12 +529,12 @@ describe.each(runtimes.runtimeList)(
527529
`run: ${nums}->{select: t is array_join(['a', null], ',', 'x')}`
528530
).malloyResultMatches(runtime, {t: 'a,x'});
529531
});
530-
it('runs array_least_frequent(a)', async () => {
532+
it.when(presto)('runs array_least_frequent(a)', async () => {
531533
await expect(
532534
`run: ${nums}->{select: t is array_least_frequent(nums)}`
533535
).malloyResultMatches(runtime, {t: [4]});
534536
});
535-
it('runs array_least_frequent(a, n)', async () => {
537+
it.when(presto)('runs array_least_frequent(a, n)', async () => {
536538
await expect(
537539
`run: ${nums}->{select: t is array_least_frequent(nums, 2)}`
538540
).malloyResultMatches(runtime, {t: [4, 1]});

0 commit comments

Comments
 (0)