@malloydata/malloy 0.0.225-dev241219181305 → 0.0.225-dev241220203531
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.
|
@@ -54,6 +54,7 @@ const limit_1 = require("../query-properties/limit");
|
|
|
54
54
|
const partition_by_1 = require("./partition_by");
|
|
55
55
|
const expression_def_1 = require("../types/expression-def");
|
|
56
56
|
const expr_func_1 = require("./expr-func");
|
|
57
|
+
const composite_source_utils_1 = require("../../../model/composite_source_utils");
|
|
57
58
|
class ExprProps extends expression_def_1.ExpressionDef {
|
|
58
59
|
constructor(expr, statements) {
|
|
59
60
|
super({ expr, statements });
|
|
@@ -80,6 +81,7 @@ class ExprProps extends expression_def_1.ExpressionDef {
|
|
|
80
81
|
if (this.typeCheck(this.expr, { ...expr, expressionType: 'scalar' })) {
|
|
81
82
|
return {
|
|
82
83
|
...expr,
|
|
84
|
+
compositeFieldUsage: (0, composite_source_utils_1.mergeCompositeFieldUsage)(expr.compositeFieldUsage, ...filterList.map(f => f.compositeFieldUsage)),
|
|
83
85
|
value: {
|
|
84
86
|
node: 'filteredExpr',
|
|
85
87
|
kids: { e: expr.value, filterList },
|
|
@@ -43,6 +43,7 @@ describe('composite sources', () => {
|
|
|
43
43
|
source: x is compose(ab, ab) extend {
|
|
44
44
|
dimension: aif is ai + af
|
|
45
45
|
measure: ss is ai.sum()
|
|
46
|
+
measure: saiaf is ai.sum() { where: af > 1 }
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
source: y is compose(ab, ab) extend {
|
|
@@ -79,6 +80,10 @@ describe('composite sources', () => {
|
|
|
79
80
|
const mexpr = (0, test_translator_1.makeExprFunc)(m.translator.modelDef, 'x');
|
|
80
81
|
expect(mexpr `ss`).hasCompositeUsage(paths([['ai']]));
|
|
81
82
|
});
|
|
83
|
+
test('measure with filter defined in composite source', () => {
|
|
84
|
+
const mexpr = (0, test_translator_1.makeExprFunc)(m.translator.modelDef, 'x');
|
|
85
|
+
expect(mexpr `saiaf`).hasCompositeUsage(paths([['ai'], ['af']]));
|
|
86
|
+
});
|
|
82
87
|
});
|
|
83
88
|
describe('composite source resolution and validation', () => {
|
|
84
89
|
test('compose fails on group_by that is relevant', () => {
|