@malloydata/malloy 0.0.222-dev241212021944 → 0.0.222-dev241212154316
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.
|
@@ -160,6 +160,30 @@ describe('composite sources', () => {
|
|
|
160
160
|
run: foo(param is 2) -> { group_by: y }
|
|
161
161
|
`).toTranslate();
|
|
162
162
|
});
|
|
163
|
+
test('array.each is okay', () => {
|
|
164
|
+
expect(`
|
|
165
|
+
##! experimental { composite_sources }
|
|
166
|
+
source: foo is compose(
|
|
167
|
+
a extend { dimension: x is 1 },
|
|
168
|
+
a extend { dimension: y is 2 }
|
|
169
|
+
) extend {
|
|
170
|
+
dimension: arr is [1, 2, 3]
|
|
171
|
+
}
|
|
172
|
+
run: foo -> { group_by: y, arr.each }
|
|
173
|
+
`).toTranslate();
|
|
174
|
+
});
|
|
175
|
+
test('timevalue extract okay', () => {
|
|
176
|
+
expect(`
|
|
177
|
+
##! experimental { composite_sources }
|
|
178
|
+
source: foo is compose(
|
|
179
|
+
a extend { dimension: x is 1 },
|
|
180
|
+
a extend { dimension: y is 2 }
|
|
181
|
+
) extend {
|
|
182
|
+
dimension: time is now
|
|
183
|
+
}
|
|
184
|
+
run: foo -> { group_by: y, time.day }
|
|
185
|
+
`).toTranslate();
|
|
186
|
+
});
|
|
163
187
|
});
|
|
164
188
|
});
|
|
165
189
|
//# sourceMappingURL=composite-field-usage.spec.js.map
|
|
@@ -99,11 +99,15 @@ function _resolveCompositeSources(path, source, compositeFieldUsage, narrowedCom
|
|
|
99
99
|
error: { code: 'composite_source_not_defined', data: { path: newPath } },
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
if (!(0, malloy_types_1.isJoined)(join)
|
|
102
|
+
if (!(0, malloy_types_1.isJoined)(join)) {
|
|
103
103
|
return {
|
|
104
104
|
error: { code: 'composite_source_not_a_join', data: { path: newPath } },
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
+
else if (!(0, malloy_types_1.isSourceDef)(join)) {
|
|
108
|
+
// Non-source join, like an array, skip it (no need to resolve)
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
107
111
|
const resolved = _resolveCompositeSources(newPath, join, joinedUsage, narrowedJoinedSources[joinName]);
|
|
108
112
|
if ('error' in resolved) {
|
|
109
113
|
return resolved;
|