@malloydata/malloy 0.0.75-dev230815210351 → 0.0.75-dev230815234740
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/dist/dialect/dialect.d.ts +1 -0
- package/dist/dialect/duckdb/duckdb.d.ts +1 -0
- package/dist/dialect/duckdb/duckdb.js +3 -0
- package/dist/dialect/postgres/postgres.d.ts +1 -0
- package/dist/dialect/postgres/postgres.js +3 -0
- package/dist/dialect/standardsql/standardsql.d.ts +1 -0
- package/dist/dialect/standardsql/standardsql.js +3 -0
- package/dist/model/malloy_query.js +2 -2
- package/package.json +1 -1
|
@@ -69,6 +69,7 @@ export declare abstract class Dialect {
|
|
|
69
69
|
abstract sqlLiteralRegexp(literal: string): string;
|
|
70
70
|
abstract sqlRegexpMatch(expr: Expr, regex: Expr): Expr;
|
|
71
71
|
abstract castToString(expression: string): string;
|
|
72
|
+
abstract concat(...values: string[]): string;
|
|
72
73
|
sqlLiteralNumber(literal: string): string;
|
|
73
74
|
dialectExpr(qi: QueryInfo, df: DialectFragment): Expr;
|
|
74
75
|
sqlSumDistinct(_key: string, _value: string, _funcName: string): string;
|
|
@@ -55,4 +55,5 @@ export declare class DuckDBDialect extends Dialect {
|
|
|
55
55
|
sqlLiteralRegexp(literal: string): string;
|
|
56
56
|
getGlobalFunctionDef(name: string): DialectFunctionOverloadDef[] | undefined;
|
|
57
57
|
castToString(expression: string): string;
|
|
58
|
+
concat(...values: string[]): string;
|
|
58
59
|
}
|
|
@@ -338,6 +338,9 @@ class DuckDBDialect extends dialect_1.Dialect {
|
|
|
338
338
|
castToString(expression) {
|
|
339
339
|
return `CAST(${expression} as VARCHAR)`;
|
|
340
340
|
}
|
|
341
|
+
concat(...values) {
|
|
342
|
+
return values.join(' || ');
|
|
343
|
+
}
|
|
341
344
|
}
|
|
342
345
|
exports.DuckDBDialect = DuckDBDialect;
|
|
343
346
|
//# sourceMappingURL=duckdb.js.map
|
|
@@ -56,4 +56,5 @@ export declare class PostgresDialect extends Dialect {
|
|
|
56
56
|
sqlLiteralRegexp(literal: string): string;
|
|
57
57
|
getGlobalFunctionDef(name: string): DialectFunctionOverloadDef[] | undefined;
|
|
58
58
|
castToString(expression: string): string;
|
|
59
|
+
concat(...values: string[]): string;
|
|
59
60
|
}
|
|
@@ -360,6 +360,9 @@ class PostgresDialect extends dialect_1.Dialect {
|
|
|
360
360
|
castToString(expression) {
|
|
361
361
|
return `CAST(${expression} as VARCHAR)`;
|
|
362
362
|
}
|
|
363
|
+
concat(...values) {
|
|
364
|
+
return values.join(' || ');
|
|
365
|
+
}
|
|
363
366
|
}
|
|
364
367
|
exports.PostgresDialect = PostgresDialect;
|
|
365
368
|
//# sourceMappingURL=postgres.js.map
|
|
@@ -52,4 +52,5 @@ export declare class StandardSQLDialect extends Dialect {
|
|
|
52
52
|
sqlLiteralRegexp(literal: string): string;
|
|
53
53
|
getGlobalFunctionDef(name: string): DialectFunctionOverloadDef[] | undefined;
|
|
54
54
|
castToString(expression: string): string;
|
|
55
|
+
concat(...values: string[]): string;
|
|
55
56
|
}
|
|
@@ -420,6 +420,9 @@ ${(0, utils_1.indent)(sql)}
|
|
|
420
420
|
castToString(expression) {
|
|
421
421
|
return `CAST(${expression} as STRING)`;
|
|
422
422
|
}
|
|
423
|
+
concat(...values) {
|
|
424
|
+
return values.join(' || ');
|
|
425
|
+
}
|
|
423
426
|
}
|
|
424
427
|
exports.StandardSQLDialect = StandardSQLDialect;
|
|
425
428
|
//# sourceMappingURL=standardsql.js.map
|
|
@@ -2592,10 +2592,10 @@ class QueryQueryIndexStage extends QueryQuery {
|
|
|
2592
2592
|
s += " CASE group_set\n WHEN 99999 THEN ''";
|
|
2593
2593
|
for (let i = 0; i < fields.length; i++) {
|
|
2594
2594
|
if (fields[i].type === 'number') {
|
|
2595
|
-
s += ` WHEN ${i} THEN ${dialect.
|
|
2595
|
+
s += ` WHEN ${i} THEN ${dialect.concat(`MIN(${dialect.castToString(fields[i].expression)})`, "' to '", dialect.castToString(`MAX(${fields[i].expression})`))}\n`;
|
|
2596
2596
|
}
|
|
2597
2597
|
if (fields[i].type === 'timestamp' || fields[i].type === 'date') {
|
|
2598
|
-
s += ` WHEN ${i} THEN MIN(${dialect.sqlDateToString(fields[i].expression)}
|
|
2598
|
+
s += ` WHEN ${i} THEN ${dialect.concat(`MIN(${dialect.sqlDateToString(fields[i].expression)}`, "' to '", `MAX(${dialect.sqlDateToString(fields[i].expression)})`)}\n`;
|
|
2599
2599
|
}
|
|
2600
2600
|
}
|
|
2601
2601
|
s += ` END as ${fieldRangeColumn}\n`;
|