@malloydata/malloy 0.0.179 → 0.0.180-dev240906180931
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/lang/ast/expressions/expr-not.js +1 -2
- package/dist/lang/ast/index.d.ts +0 -1
- package/dist/lang/ast/index.js +0 -1
- package/dist/lang/ast/types/expression-def.js +2 -10
- package/dist/lang/lib/Malloy/MalloyLexer.d.ts +91 -90
- package/dist/lang/lib/Malloy/MalloyLexer.js +1122 -1116
- package/dist/lang/lib/Malloy/MalloyParser.d.ts +111 -90
- package/dist/lang/lib/Malloy/MalloyParser.js +987 -855
- package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +26 -0
- package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +16 -0
- package/dist/lang/malloy-to-ast.d.ts +4 -1
- package/dist/lang/malloy-to-ast.js +36 -0
- package/dist/lang/parse-log.d.ts +1 -0
- package/dist/lang/test/expressions.spec.js +88 -86
- package/dist/lang/test/parse-expects.d.ts +13 -6
- package/dist/lang/test/parse-expects.js +80 -0
- package/dist/lang/test/test-translator.d.ts +2 -1
- package/dist/lang/test/test-translator.js +41 -1
- package/dist/model/malloy_query.js +13 -5
- package/package.json +1 -1
- package/dist/lang/ast/expressions/utils.d.ts +0 -3
- package/dist/lang/ast/expressions/utils.js +0 -39
|
@@ -795,13 +795,17 @@ class QueryField extends QueryNode {
|
|
|
795
795
|
case '*':
|
|
796
796
|
case '%':
|
|
797
797
|
case '/':
|
|
798
|
-
case '=':
|
|
799
|
-
case '!=':
|
|
800
798
|
case '>':
|
|
801
799
|
case '<':
|
|
802
800
|
case '>=':
|
|
803
801
|
case '<=':
|
|
802
|
+
case '=':
|
|
804
803
|
return `${expr.kids.left.sql}${expr.node}${expr.kids.right.sql}`;
|
|
804
|
+
// Malloy inequality comparisons always return a boolean
|
|
805
|
+
case '!=': {
|
|
806
|
+
const notEqual = `${expr.kids.left.sql}!=${expr.kids.right.sql}`;
|
|
807
|
+
return `COALESCE(${notEqual},true)`;
|
|
808
|
+
}
|
|
805
809
|
case 'and':
|
|
806
810
|
case 'or':
|
|
807
811
|
return `${expr.kids.left.sql} ${expr.node} ${expr.kids.right.sql}`;
|
|
@@ -809,12 +813,16 @@ class QueryField extends QueryNode {
|
|
|
809
813
|
return `COALESCE(${expr.kids.left.sql},${expr.kids.right.sql})`;
|
|
810
814
|
case 'like':
|
|
811
815
|
return `${expr.kids.left.sql} LIKE ${expr.kids.right.sql}`;
|
|
812
|
-
|
|
813
|
-
|
|
816
|
+
// Malloy inequality comparisons always return a boolean
|
|
817
|
+
case '!like': {
|
|
818
|
+
const notLike = `${expr.kids.left.sql} NOT LIKE ${expr.kids.right.sql}`;
|
|
819
|
+
return `COALESCE(${notLike},true)`;
|
|
820
|
+
}
|
|
814
821
|
case '()':
|
|
815
822
|
return `(${expr.e.sql})`;
|
|
816
823
|
case 'not':
|
|
817
|
-
|
|
824
|
+
// Malloy not operator always returns a boolean
|
|
825
|
+
return `COALESCE(NOT ${expr.e.sql},TRUE)`;
|
|
818
826
|
case 'unary-':
|
|
819
827
|
return `-${expr.e.sql}`;
|
|
820
828
|
case 'is-null':
|
package/package.json
CHANGED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright 2023 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
* a copy of this software and associated documentation files
|
|
7
|
-
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
-
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
-
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
-
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
-
* subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be
|
|
14
|
-
* included in all copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
-
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
-
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
-
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
-
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.nullsafeNot = void 0;
|
|
26
|
-
function nullsafeNot(expr, op) {
|
|
27
|
-
if (op === undefined || op === '!=' || op === '!~') {
|
|
28
|
-
return {
|
|
29
|
-
node: 'not',
|
|
30
|
-
e: {
|
|
31
|
-
node: 'coalesce',
|
|
32
|
-
kids: { left: expr, right: { node: 'false' } },
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
return expr;
|
|
37
|
-
}
|
|
38
|
-
exports.nullsafeNot = nullsafeNot;
|
|
39
|
-
//# sourceMappingURL=utils.js.map
|