@malloydata/malloy 0.0.36-dev230524213240 → 0.0.36-dev230524224445
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.
|
@@ -32,15 +32,18 @@ class DefineQuery extends malloy_element_1.MalloyElement {
|
|
|
32
32
|
this.elementType = 'defineQuery';
|
|
33
33
|
}
|
|
34
34
|
execute(doc) {
|
|
35
|
+
const existing = doc.getEntry(this.name);
|
|
36
|
+
if (existing) {
|
|
37
|
+
this.log(`Query '${this.name}' is already defined, cannot redefine`);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
35
40
|
const entry = {
|
|
36
41
|
...this.queryDetails.query(),
|
|
37
42
|
type: 'query',
|
|
38
43
|
name: this.name,
|
|
39
44
|
location: this.location,
|
|
40
45
|
};
|
|
41
|
-
|
|
42
|
-
doc.setEntry(this.name, { entry, exported });
|
|
43
|
-
return undefined;
|
|
46
|
+
doc.setEntry(this.name, { entry, exported: true });
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
49
|
exports.DefineQuery = DefineQuery;
|
|
@@ -216,6 +216,9 @@ describe('model statements', () => {
|
|
|
216
216
|
}
|
|
217
217
|
`));
|
|
218
218
|
});
|
|
219
|
+
test('errors on redefinition of query', () => {
|
|
220
|
+
expect('query: q1 is a -> { project: * }, q1 is a -> { project: * }').compileToFailWith("Query 'q1' is already defined, cannot redefine");
|
|
221
|
+
});
|
|
219
222
|
});
|
|
220
223
|
describe('explore properties', () => {
|
|
221
224
|
test('single dimension', modelOK('explore: aa is a { dimension: x is 1 }'));
|