@malloydata/malloy 0.0.197-dev241009140241 → 0.0.197-dev241009205116
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.
|
@@ -36,10 +36,6 @@ const dialect_1 = require("../dialect");
|
|
|
36
36
|
const functions_1 = require("../functions");
|
|
37
37
|
const dialect_functions_1 = require("./dialect_functions");
|
|
38
38
|
const function_overrides_1 = require("./function_overrides");
|
|
39
|
-
const castMap = {
|
|
40
|
-
number: 'double precision',
|
|
41
|
-
string: 'varchar(255)',
|
|
42
|
-
};
|
|
43
39
|
const msExtractionMap = {
|
|
44
40
|
day_of_week: 'DAYOFWEEK',
|
|
45
41
|
day_of_year: 'DAYOFYEAR',
|
|
@@ -106,15 +102,16 @@ class MySQLDialect extends dialect_1.Dialect {
|
|
|
106
102
|
this.supportsArraysInData = false;
|
|
107
103
|
}
|
|
108
104
|
malloyTypeToSQLType(malloyType) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return 'BIGINT';
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
105
|
+
switch (malloyType.type) {
|
|
106
|
+
case 'number':
|
|
107
|
+
return malloyType.numberType === 'integer' ? 'BIGINT' : 'DOUBLE';
|
|
108
|
+
case 'string':
|
|
109
|
+
return 'CHAR';
|
|
110
|
+
case 'date':
|
|
111
|
+
case 'timestamp':
|
|
112
|
+
default:
|
|
113
|
+
return malloyType.type;
|
|
116
114
|
}
|
|
117
|
-
return malloyType.type;
|
|
118
115
|
}
|
|
119
116
|
sqlTypeToMalloyType(sqlType) {
|
|
120
117
|
var _a, _b;
|
|
@@ -354,7 +351,7 @@ class MySQLDialect extends dialect_1.Dialect {
|
|
|
354
351
|
}
|
|
355
352
|
if (cast.srcType !== cast.dstType) {
|
|
356
353
|
const dstType = typeof cast.dstType === 'string'
|
|
357
|
-
?
|
|
354
|
+
? this.malloyTypeToSQLType({ type: cast.dstType })
|
|
358
355
|
: cast.dstType.raw;
|
|
359
356
|
if (cast.safe) {
|
|
360
357
|
throw new Error("Mysql dialect doesn't support Safe Cast");
|
|
@@ -50,6 +50,9 @@ class ExprCast extends expression_def_1.ExpressionDef {
|
|
|
50
50
|
else {
|
|
51
51
|
this.logError('invalid-sql-native-type', `Cast type \`${this.castType.raw}\` is invalid for ${dialect.name} dialect`);
|
|
52
52
|
}
|
|
53
|
+
if (this.safe && !dialect.supportsSafeCast) {
|
|
54
|
+
this.logError('dialect-cast-unsafe-only', `The SQL dialect '${fs.dialectName()}' does not supply a safe cast operator`);
|
|
55
|
+
}
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
58
|
return {
|
package/dist/lang/parse-log.d.ts
CHANGED
|
@@ -315,6 +315,7 @@ type MessageParameterTypes = {
|
|
|
315
315
|
'sql-is-not-null': string;
|
|
316
316
|
'sql-is-null': string;
|
|
317
317
|
'illegal-record-property-type': string;
|
|
318
|
+
'dialect-cast-unsafe-only': string;
|
|
318
319
|
};
|
|
319
320
|
export declare const MESSAGE_FORMATTERS: PartialErrorCodeMessageMap;
|
|
320
321
|
export type MessageCode = keyof MessageParameterTypes;
|