@malloydata/malloy 0.0.223-dev241216182944 → 0.0.223-dev241216191808
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.
|
@@ -18,6 +18,16 @@ const dayname = {
|
|
|
18
18
|
returns: 'string',
|
|
19
19
|
impl: { function: 'DAYNAME' },
|
|
20
20
|
};
|
|
21
|
+
const date_part = {
|
|
22
|
+
takes: { 'part': 'string', 'interval': { sql_native: 'interval' } },
|
|
23
|
+
returns: 'number',
|
|
24
|
+
impl: { function: 'DATE_PART' },
|
|
25
|
+
};
|
|
26
|
+
const to_seconds = {
|
|
27
|
+
takes: { 'seconds': 'number' },
|
|
28
|
+
returns: { sql_native: 'interval' },
|
|
29
|
+
impl: { function: 'TO_SECONDS' },
|
|
30
|
+
};
|
|
21
31
|
const to_timestamp = {
|
|
22
32
|
takes: { 'epoch_seconds': 'number' },
|
|
23
33
|
returns: 'timestamp',
|
|
@@ -77,5 +87,7 @@ exports.DUCKDB_DIALECT_FUNCTIONS = {
|
|
|
77
87
|
to_timestamp,
|
|
78
88
|
string_agg,
|
|
79
89
|
string_agg_distinct,
|
|
90
|
+
to_seconds,
|
|
91
|
+
date_part,
|
|
80
92
|
};
|
|
81
93
|
//# sourceMappingURL=dialect_functions.js.map
|
|
@@ -69,8 +69,11 @@ export type TypeDescElementBlueprintOrNamedGeneric = TypeDescElementBlueprint |
|
|
|
69
69
|
export interface RecordBlueprint {
|
|
70
70
|
record: Record<string, TypeDescElementBlueprintOrNamedGeneric>;
|
|
71
71
|
}
|
|
72
|
+
export interface SQLNativeTypeBlueprint {
|
|
73
|
+
sql_native: string;
|
|
74
|
+
}
|
|
72
75
|
export type LeafPlusType = LeafExpressionType | 'any';
|
|
73
|
-
export type TypeDescElementBlueprint = LeafPlusType | ArrayBlueprint | RecordBlueprint;
|
|
76
|
+
export type TypeDescElementBlueprint = LeafPlusType | ArrayBlueprint | RecordBlueprint | SQLNativeTypeBlueprint;
|
|
74
77
|
export type NamedGeneric = {
|
|
75
78
|
generic: string;
|
|
76
79
|
};
|
|
@@ -195,6 +195,9 @@ function expandTypeDescElementBlueprint(blueprint, allowAny = true, allowGeneric
|
|
|
195
195
|
}
|
|
196
196
|
return { type: 'generic', generic: blueprint.generic };
|
|
197
197
|
}
|
|
198
|
+
else if ('sql_native' in blueprint) {
|
|
199
|
+
return { type: 'sql native', rawType: blueprint.sql_native };
|
|
200
|
+
}
|
|
198
201
|
throw new Error('Cannot figure out type');
|
|
199
202
|
}
|
|
200
203
|
function expandReturnTypeBlueprint(blueprint) {
|
|
@@ -225,6 +228,9 @@ function expandReturnTypeBlueprint(blueprint) {
|
|
|
225
228
|
else if ('measure' in blueprint) {
|
|
226
229
|
return minAggregate(expandTypeDescElementBlueprint(blueprint.measure, false));
|
|
227
230
|
}
|
|
231
|
+
else if ('sql_native' in blueprint) {
|
|
232
|
+
return anyExprType({ type: 'sql native', rawType: blueprint.sql_native });
|
|
233
|
+
}
|
|
228
234
|
else {
|
|
229
235
|
return minAnalytic(expandTypeDescElementBlueprint(blueprint.calculation, false));
|
|
230
236
|
}
|
|
@@ -238,7 +244,8 @@ function isTypeDescBlueprint(blueprint) {
|
|
|
238
244
|
'constant' in blueprint ||
|
|
239
245
|
'dimension' in blueprint ||
|
|
240
246
|
'measure' in blueprint ||
|
|
241
|
-
'calculation' in blueprint
|
|
247
|
+
'calculation' in blueprint ||
|
|
248
|
+
'sql_native' in blueprint);
|
|
242
249
|
}
|
|
243
250
|
function extractParamTypeBlueprints(blueprint) {
|
|
244
251
|
if (isTypeDescBlueprint(blueprint)) {
|
|
@@ -279,6 +286,9 @@ function expandParamTypeBlueprint(blueprint) {
|
|
|
279
286
|
else if ('record' in blueprint) {
|
|
280
287
|
return anyExprType(expandTypeDescElementBlueprint(blueprint, false));
|
|
281
288
|
}
|
|
289
|
+
else if ('sql_native' in blueprint) {
|
|
290
|
+
return anyExprType({ type: 'sql native', rawType: blueprint.sql_native });
|
|
291
|
+
}
|
|
282
292
|
else {
|
|
283
293
|
return maxAnalytic(expandTypeDescElementBlueprint(blueprint.calculation));
|
|
284
294
|
}
|