Skip to content

Commit 2e51edd

Browse files
inherit array most places
1 parent 99b8cdd commit 2e51edd

File tree

4 files changed

+3
-19
lines changed

4 files changed

+3
-19
lines changed

packages/malloy/src/dialect/duckdb/duckdb.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -448,11 +448,6 @@ export class DuckDBDialect extends PostgresBase {
448448
return `DATE_SUB('${df.units}', ${lVal}, ${rVal})`;
449449
}
450450

451-
sqlLiteralArray(lit: ArrayLiteralNode): string {
452-
const array = lit.kids.values.map(val => val.sql);
453-
return '[' + array.join(',') + ']';
454-
}
455-
456451
sqlLiteralRecord(lit: RecordLiteralNode): string {
457452
const pairs = Object.entries(lit.kids).map(
458453
([propName, propVal]) =>

packages/malloy/src/dialect/pg_impl.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ export abstract class PostgresBase extends Dialect {
102102
throw new Error('Cannot create a record literal for postgres base dialect');
103103
}
104104

105-
sqlLiteralArray(_lit: ArrayLiteralNode): string {
106-
throw new Error('Cannot create array literal for postgres base dialect');
105+
sqlLiteralArray(lit: ArrayLiteralNode): string {
106+
const array = lit.kids.values.map(val => val.sql);
107+
return 'ARRAY[' + array.join(',') + ']';
107108
}
108109
}

packages/malloy/src/dialect/postgres/postgres.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import {
3333
MeasureTimeExpr,
3434
LeafAtomicTypeDef,
3535
RecordLiteralNode,
36-
ArrayLiteralNode,
3736
} from '../../model/malloy_types';
3837
import {
3938
DialectFunctionOverloadDef,
@@ -455,9 +454,4 @@ export class PostgresDialect extends PostgresBase {
455454
}
456455
return `JSONB_BUILD_OBJECT(${props.join(', ')})`;
457456
}
458-
459-
sqlLiteralArray(lit: ArrayLiteralNode): string {
460-
const array = lit.kids.values.map(val => val.sql);
461-
return `ARRAY[${array.join(',')}]`;
462-
}
463457
}

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import {
3737
TimeExtractExpr,
3838
LeafAtomicTypeDef,
3939
TD,
40-
ArrayLiteralNode,
4140
RecordLiteralNode,
4241
isAtomic,
4342
} from '../../model/malloy_types';
@@ -638,11 +637,6 @@ ${indent(sql)}
638637
return from.units === 'day_of_week' ? `mod(${extracted}+1,7)` : extracted;
639638
}
640639

641-
sqlLiteralArray(lit: ArrayLiteralNode): string {
642-
const array = lit.kids.values.map(val => val.sql);
643-
return 'ARRAY[' + array.join(',') + ']';
644-
}
645-
646640
sqlLiteralRecord(lit: RecordLiteralNode): string {
647641
const rowVals: string[] = [];
648642
const rowTypes: string[] = [];

0 commit comments

Comments
 (0)