@malloydata/malloy 0.0.107 → 0.0.108-dev231130212526
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.
|
@@ -75,7 +75,11 @@ class FieldDeclaration extends malloy_element_1.MalloyElement {
|
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
const compressValue = (0, utils_1.compressExpr)(exprValue.value);
|
|
78
|
-
|
|
78
|
+
let retType = exprValue.dataType;
|
|
79
|
+
if (retType === 'null') {
|
|
80
|
+
this.expr.log('null value defaults to type number, use "null::TYPE" to specify correct type', 'warn');
|
|
81
|
+
retType = 'number';
|
|
82
|
+
}
|
|
79
83
|
if ((0, malloy_types_1.isAtomicFieldType)(retType) && retType !== 'error') {
|
|
80
84
|
const template = {
|
|
81
85
|
name: exprName,
|
|
@@ -322,7 +322,7 @@ describe('error cascading', () => {
|
|
|
322
322
|
source: a1 is a extend {
|
|
323
323
|
join_one: b with astr
|
|
324
324
|
dimension:
|
|
325
|
-
${'err is
|
|
325
|
+
${'err is nothing'}
|
|
326
326
|
${scalars.map((d, i) => `e${i} is ${d}`).join('\n ')}
|
|
327
327
|
measure:
|
|
328
328
|
measure_err is count(foo),
|
|
@@ -330,18 +330,18 @@ describe('error cascading', () => {
|
|
|
330
330
|
.map((m, i) => `e${i + scalars.length} is ${m}`)
|
|
331
331
|
.join('\n ')}
|
|
332
332
|
}
|
|
333
|
-
`).translationToFailWith("
|
|
333
|
+
`).translationToFailWith("'nothing' is not defined", "'foo' is not defined");
|
|
334
334
|
});
|
|
335
335
|
test('error type inference is good', () => {
|
|
336
336
|
for (const scalar of scalars) {
|
|
337
337
|
const source = `
|
|
338
338
|
source: a1 is a extend {
|
|
339
339
|
dimension:
|
|
340
|
-
${'err is
|
|
340
|
+
${'err is nothing'}
|
|
341
341
|
dim is length(${scalar}, 1)
|
|
342
342
|
}
|
|
343
343
|
`;
|
|
344
|
-
expect(source).translationToFailWith("
|
|
344
|
+
expect(source).translationToFailWith("'nothing' is not defined", `No matching overload for function length(${typedScalars[scalar]}, number)`);
|
|
345
345
|
}
|
|
346
346
|
});
|
|
347
347
|
test('eval space of errors is preserved', () => {
|
|
@@ -351,7 +351,7 @@ describe('error cascading', () => {
|
|
|
351
351
|
}
|
|
352
352
|
run: a1 -> {
|
|
353
353
|
group_by:
|
|
354
|
-
${'err is
|
|
354
|
+
${'err is nothing'}
|
|
355
355
|
aggregate:
|
|
356
356
|
measure_err is count(foo)
|
|
357
357
|
calculate:
|
|
@@ -362,7 +362,7 @@ describe('error cascading', () => {
|
|
|
362
362
|
.map((m, i) => `e${i + scalars.length} is lag(${m})`)
|
|
363
363
|
.join('\n ')}
|
|
364
364
|
}
|
|
365
|
-
`).translationToFailWith("
|
|
365
|
+
`).translationToFailWith("'nothing' is not defined", "'foo' is not defined");
|
|
366
366
|
});
|
|
367
367
|
});
|
|
368
368
|
describe('pipeline comprehension', () => {
|
|
@@ -64,6 +64,9 @@ describe('source:', () => {
|
|
|
64
64
|
test('single dimension', () => {
|
|
65
65
|
expect('source: aa is a extend { dimension: x is 1 }').toTranslate();
|
|
66
66
|
});
|
|
67
|
+
test('field def with null value', () => {
|
|
68
|
+
expect((0, test_translator_1.markSource) `source: aa is a extend { dimension: x is ${'null'} }`).toTranslateWithWarnings('null value defaults to type number, use "null::TYPE" to specify correct type');
|
|
69
|
+
});
|
|
67
70
|
test('multiple dimensions', () => {
|
|
68
71
|
expect(`
|
|
69
72
|
source: aa is a extend {
|