@finos/legend-data-cube 0.0.41 → 0.0.43
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/lib/components/DataCube.d.ts.map +1 -1
- package/lib/components/DataCube.js +1 -1
- package/lib/components/DataCube.js.map +1 -1
- package/lib/components/DataCubePlaceholder.d.ts +0 -1
- package/lib/components/DataCubePlaceholder.d.ts.map +1 -1
- package/lib/components/DataCubePlaceholder.js.map +1 -1
- package/lib/components/core/DataCubeCodeCheckErrorAlert.d.ts.map +1 -1
- package/lib/components/core/DataCubeCodeCheckErrorAlert.js +5 -1
- package/lib/components/core/DataCubeCodeCheckErrorAlert.js.map +1 -1
- package/lib/components/view/extend/DataCubeColumnEditor.d.ts.map +1 -1
- package/lib/components/view/extend/DataCubeColumnEditor.js +5 -2
- package/lib/components/view/extend/DataCubeColumnEditor.js.map +1 -1
- package/lib/components/view/filter/DataCubeFilterEditor.d.ts.map +1 -1
- package/lib/components/view/filter/DataCubeFilterEditor.js +3 -3
- package/lib/components/view/filter/DataCubeFilterEditor.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/package.json +4 -4
- package/lib/stores/core/DataCubeQueryBuilder.d.ts.map +1 -1
- package/lib/stores/core/DataCubeQueryBuilder.js +12 -6
- package/lib/stores/core/DataCubeQueryBuilder.js.map +1 -1
- package/lib/stores/core/DataCubeQueryBuilderUtils.d.ts +5 -5
- package/lib/stores/core/DataCubeQueryBuilderUtils.d.ts.map +1 -1
- package/lib/stores/core/DataCubeQueryBuilderUtils.js +20 -20
- package/lib/stores/core/DataCubeQueryBuilderUtils.js.map +1 -1
- package/lib/stores/core/DataCubeQueryEngine.d.ts +4 -2
- package/lib/stores/core/DataCubeQueryEngine.d.ts.map +1 -1
- package/lib/stores/core/DataCubeQueryEngine.js +13 -0
- package/lib/stores/core/DataCubeQueryEngine.js.map +1 -1
- package/lib/stores/core/DataCubeQuerySnapshot.d.ts +1 -1
- package/lib/stores/core/DataCubeQuerySnapshot.d.ts.map +1 -1
- package/lib/stores/core/DataCubeQuerySnapshotBuilder.d.ts +2 -1
- package/lib/stores/core/DataCubeQuerySnapshotBuilder.d.ts.map +1 -1
- package/lib/stores/core/DataCubeQuerySnapshotBuilder.js +86 -53
- package/lib/stores/core/DataCubeQuerySnapshotBuilder.js.map +1 -1
- package/lib/stores/core/DataCubeQuerySnapshotBuilderUtils.d.ts +37 -8
- package/lib/stores/core/DataCubeQuerySnapshotBuilderUtils.d.ts.map +1 -1
- package/lib/stores/core/DataCubeQuerySnapshotBuilderUtils.js +227 -203
- package/lib/stores/core/DataCubeQuerySnapshotBuilderUtils.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterEditorState.d.ts +3 -3
- package/lib/stores/core/filter/DataCubeQueryFilterEditorState.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterEditorState.js +4 -8
- package/lib/stores/core/filter/DataCubeQueryFilterEditorState.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation.d.ts +7 -3
- package/lib/stores/core/filter/DataCubeQueryFilterOperation.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation.js +16 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__Contain.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__Contain.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__Contain.js +10 -14
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__Contain.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__ContainCaseInsensitive.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__ContainCaseInsensitive.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__ContainCaseInsensitive.js +10 -14
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__ContainCaseInsensitive.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EndWith.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EndWith.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EndWith.js +10 -14
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EndWith.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EndWithCaseInsensitive.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EndWithCaseInsensitive.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EndWithCaseInsensitive.js +10 -14
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EndWithCaseInsensitive.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__Equal.d.ts +1 -2
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__Equal.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__Equal.js +15 -90
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__Equal.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EqualCaseInsensitive.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EqualCaseInsensitive.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EqualCaseInsensitive.js +10 -14
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EqualCaseInsensitive.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EqualCaseInsensitiveColumn.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EqualCaseInsensitiveColumn.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EqualCaseInsensitiveColumn.js +6 -14
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EqualCaseInsensitiveColumn.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EqualColumn.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EqualColumn.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EqualColumn.js +6 -14
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EqualColumn.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThan.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThan.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThan.js +14 -18
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThan.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanColumn.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanColumn.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanColumn.js +6 -14
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanColumn.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanOrEqual.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanOrEqual.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanOrEqual.js +14 -18
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanOrEqual.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanOrEqualColumn.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanOrEqualColumn.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanOrEqualColumn.js +6 -14
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanOrEqualColumn.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__IsNotNull.d.ts +6 -4
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__IsNotNull.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__IsNotNull.js +15 -15
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__IsNotNull.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__IsNull.d.ts +6 -4
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__IsNull.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__IsNull.js +10 -15
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__IsNull.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThan.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThan.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThan.js +14 -18
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThan.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThanColumn.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThanColumn.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThanColumn.js +6 -14
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThanColumn.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThanOrEqual.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThanOrEqual.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThanOrEqual.js +14 -18
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThanOrEqual.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThanOrEqualColumn.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThanOrEqualColumn.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThanOrEqualColumn.js +6 -14
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThanOrEqualColumn.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotContain.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotContain.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotContain.js +14 -14
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotContain.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEndWith.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEndWith.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEndWith.js +14 -14
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEndWith.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqual.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqual.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqual.js +19 -19
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqual.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqualCaseInsensitive.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqualCaseInsensitive.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqualCaseInsensitive.js +14 -14
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqualCaseInsensitive.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqualCaseInsensitiveColumn.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqualCaseInsensitiveColumn.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqualCaseInsensitiveColumn.js +10 -14
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqualCaseInsensitiveColumn.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqualColumn.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqualColumn.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqualColumn.js +10 -14
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqualColumn.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotStartWith.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotStartWith.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotStartWith.js +14 -14
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotStartWith.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__StartWith.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__StartWith.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__StartWith.js +10 -14
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__StartWith.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__StartWithCaseInsensitive.d.ts +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__StartWithCaseInsensitive.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__StartWithCaseInsensitive.js +10 -14
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__StartWithCaseInsensitive.js.map +1 -1
- package/lib/stores/core/model/DataCubeConfiguration.d.ts +2 -0
- package/lib/stores/core/model/DataCubeConfiguration.d.ts.map +1 -1
- package/lib/stores/core/model/DataCubeConfiguration.js +3 -1
- package/lib/stores/core/model/DataCubeConfiguration.js.map +1 -1
- package/lib/stores/view/DataCubeViewState.d.ts.map +1 -1
- package/lib/stores/view/DataCubeViewState.js +1 -1
- package/lib/stores/view/DataCubeViewState.js.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorColumnPropertiesPanelState.js +2 -2
- package/lib/stores/view/editor/DataCubeEditorColumnPropertiesPanelState.js.map +1 -1
- package/lib/stores/view/extend/DataCubeColumnEditorState.d.ts.map +1 -1
- package/lib/stores/view/extend/DataCubeColumnEditorState.js +3 -6
- package/lib/stores/view/extend/DataCubeColumnEditorState.js.map +1 -1
- package/lib/stores/view/filter/DataCubeFilterEditorState.d.ts.map +1 -1
- package/lib/stores/view/filter/DataCubeFilterEditorState.js +3 -3
- package/lib/stores/view/filter/DataCubeFilterEditorState.js.map +1 -1
- package/lib/stores/view/grid/DataCubeGridClientEngine.js +1 -1
- package/lib/stores/view/grid/DataCubeGridClientEngine.js.map +1 -1
- package/lib/stores/view/grid/DataCubeGridConfigurationBuilder.d.ts.map +1 -1
- package/lib/stores/view/grid/DataCubeGridConfigurationBuilder.js +5 -5
- package/lib/stores/view/grid/DataCubeGridConfigurationBuilder.js.map +1 -1
- package/lib/stores/view/grid/DataCubeGridMenuBuilder.d.ts.map +1 -1
- package/lib/stores/view/grid/DataCubeGridMenuBuilder.js +13 -5
- package/lib/stores/view/grid/DataCubeGridMenuBuilder.js.map +1 -1
- package/lib/stores/view/grid/DataCubeGridQueryBuilder.d.ts.map +1 -1
- package/lib/stores/view/grid/DataCubeGridQueryBuilder.js +8 -5
- package/lib/stores/view/grid/DataCubeGridQueryBuilder.js.map +1 -1
- package/package.json +9 -9
- package/src/components/DataCube.tsx +1 -0
- package/src/components/DataCubePlaceholder.tsx +0 -1
- package/src/components/core/DataCubeCodeCheckErrorAlert.tsx +7 -3
- package/src/components/view/extend/DataCubeColumnEditor.tsx +7 -4
- package/src/components/view/filter/DataCubeFilterEditor.tsx +10 -19
- package/src/index.tsx +1 -0
- package/src/stores/core/DataCubeQueryBuilder.ts +20 -6
- package/src/stores/core/DataCubeQueryBuilderUtils.ts +38 -33
- package/src/stores/core/DataCubeQueryEngine.ts +17 -1
- package/src/stores/core/DataCubeQuerySnapshot.ts +1 -1
- package/src/stores/core/DataCubeQuerySnapshotBuilder.ts +148 -75
- package/src/stores/core/DataCubeQuerySnapshotBuilderUtils.ts +332 -260
- package/src/stores/core/filter/DataCubeQueryFilterEditorState.ts +7 -11
- package/src/stores/core/filter/DataCubeQueryFilterOperation.ts +28 -6
- package/src/stores/core/filter/DataCubeQueryFilterOperation__Contain.tsx +13 -21
- package/src/stores/core/filter/DataCubeQueryFilterOperation__ContainCaseInsensitive.tsx +17 -21
- package/src/stores/core/filter/DataCubeQueryFilterOperation__EndWith.tsx +17 -21
- package/src/stores/core/filter/DataCubeQueryFilterOperation__EndWithCaseInsensitive.tsx +17 -21
- package/src/stores/core/filter/DataCubeQueryFilterOperation__Equal.tsx +13 -98
- package/src/stores/core/filter/DataCubeQueryFilterOperation__EqualCaseInsensitive.tsx +17 -21
- package/src/stores/core/filter/DataCubeQueryFilterOperation__EqualCaseInsensitiveColumn.tsx +13 -19
- package/src/stores/core/filter/DataCubeQueryFilterOperation__EqualColumn.tsx +9 -19
- package/src/stores/core/filter/DataCubeQueryFilterOperation__GreaterThan.tsx +17 -21
- package/src/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanColumn.tsx +13 -19
- package/src/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanOrEqual.tsx +17 -21
- package/src/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanOrEqualColumn.tsx +13 -19
- package/src/stores/core/filter/DataCubeQueryFilterOperation__IsNotNull.tsx +24 -20
- package/src/stores/core/filter/DataCubeQueryFilterOperation__IsNull.tsx +14 -20
- package/src/stores/core/filter/DataCubeQueryFilterOperation__LessThan.tsx +17 -21
- package/src/stores/core/filter/DataCubeQueryFilterOperation__LessThanColumn.tsx +13 -19
- package/src/stores/core/filter/DataCubeQueryFilterOperation__LessThanOrEqual.tsx +17 -21
- package/src/stores/core/filter/DataCubeQueryFilterOperation__LessThanOrEqualColumn.tsx +13 -19
- package/src/stores/core/filter/DataCubeQueryFilterOperation__NotContain.tsx +20 -19
- package/src/stores/core/filter/DataCubeQueryFilterOperation__NotEndWith.tsx +20 -19
- package/src/stores/core/filter/DataCubeQueryFilterOperation__NotEqual.tsx +20 -19
- package/src/stores/core/filter/DataCubeQueryFilterOperation__NotEqualCaseInsensitive.tsx +24 -19
- package/src/stores/core/filter/DataCubeQueryFilterOperation__NotEqualCaseInsensitiveColumn.tsx +25 -18
- package/src/stores/core/filter/DataCubeQueryFilterOperation__NotEqualColumn.tsx +21 -18
- package/src/stores/core/filter/DataCubeQueryFilterOperation__NotStartWith.tsx +24 -19
- package/src/stores/core/filter/DataCubeQueryFilterOperation__StartWith.tsx +17 -21
- package/src/stores/core/filter/DataCubeQueryFilterOperation__StartWithCaseInsensitive.tsx +17 -21
- package/src/stores/core/model/DataCubeConfiguration.ts +9 -1
- package/src/stores/view/DataCubeViewState.ts +1 -0
- package/src/stores/view/editor/DataCubeEditorColumnPropertiesPanelState.ts +2 -2
- package/src/stores/view/extend/DataCubeColumnEditorState.tsx +2 -5
- package/src/stores/view/filter/DataCubeFilterEditorState.tsx +3 -7
- package/src/stores/view/grid/DataCubeGridClientEngine.ts +1 -1
- package/src/stores/view/grid/DataCubeGridConfigurationBuilder.tsx +6 -6
- package/src/stores/view/grid/DataCubeGridMenuBuilder.tsx +14 -5
- package/src/stores/view/grid/DataCubeGridQueryBuilder.ts +9 -5
|
@@ -221,7 +221,10 @@ export function _collection(values: V1_ValueSpecification[]) {
|
|
|
221
221
|
return collection;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
export function _primitiveValue(
|
|
224
|
+
export function _primitiveValue(
|
|
225
|
+
type: string,
|
|
226
|
+
value: unknown,
|
|
227
|
+
): V1_PrimitiveValueSpecification {
|
|
225
228
|
const _val = <T extends V1_PrimitiveValueSpecification & { value: unknown }>(
|
|
226
229
|
primitiveValue: T,
|
|
227
230
|
val: unknown,
|
|
@@ -249,7 +252,9 @@ export function _primitiveValue(type: string, value: unknown) {
|
|
|
249
252
|
case PRIMITIVE_TYPE.STRICTTIME:
|
|
250
253
|
return _val(new V1_CStrictTime(), guaranteeIsString(value));
|
|
251
254
|
default:
|
|
252
|
-
throw new UnsupportedOperationError(
|
|
255
|
+
throw new UnsupportedOperationError(
|
|
256
|
+
`Can't build primitive value instance for unsupported type '${type}'`,
|
|
257
|
+
);
|
|
253
258
|
}
|
|
254
259
|
}
|
|
255
260
|
|
|
@@ -306,7 +311,7 @@ export function _value(
|
|
|
306
311
|
return _property(guaranteeIsString(value.value), variable);
|
|
307
312
|
default:
|
|
308
313
|
throw new UnsupportedOperationError(
|
|
309
|
-
`
|
|
314
|
+
`Can't build value instance for unsupported type '${value.type}'`,
|
|
310
315
|
);
|
|
311
316
|
}
|
|
312
317
|
}
|
|
@@ -315,14 +320,6 @@ export function _not(fn: V1_AppliedFunction) {
|
|
|
315
320
|
return _function(_functionName(DataCubeFunction.NOT), [fn]);
|
|
316
321
|
}
|
|
317
322
|
|
|
318
|
-
export function _selectFunction(columns: DataCubeColumn[]) {
|
|
319
|
-
return _function(DataCubeFunction.SELECT, [
|
|
320
|
-
_cols(columns.map((col) => _colSpec(col.name))),
|
|
321
|
-
]);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// --------------------------------- BUILDING BLOCKS ---------------------------------
|
|
325
|
-
|
|
326
323
|
export function _col(
|
|
327
324
|
name: string,
|
|
328
325
|
function1?: V1_Lambda | undefined,
|
|
@@ -340,6 +337,31 @@ export function _cols(colSpecs: V1_ColSpec[]) {
|
|
|
340
337
|
return _classInstance(V1_ClassInstanceType.COL_SPEC_ARRAY, colSpecArray);
|
|
341
338
|
}
|
|
342
339
|
|
|
340
|
+
// --------------------------------- BUILDING BLOCKS ---------------------------------
|
|
341
|
+
|
|
342
|
+
export function _selectFunction(columns: DataCubeColumn[]) {
|
|
343
|
+
return _function(DataCubeFunction.SELECT, [
|
|
344
|
+
_cols(columns.map((col) => _colSpec(col.name))),
|
|
345
|
+
]);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export function _extendRootAggregation(columnName: string) {
|
|
349
|
+
return _function(DataCubeFunction.EXTEND, [
|
|
350
|
+
_col(
|
|
351
|
+
columnName,
|
|
352
|
+
_lambda(
|
|
353
|
+
[_var()],
|
|
354
|
+
[
|
|
355
|
+
_primitiveValue(
|
|
356
|
+
PRIMITIVE_TYPE.STRING,
|
|
357
|
+
DEFAULT_ROOT_AGGREGATION_COLUMN_VALUE,
|
|
358
|
+
),
|
|
359
|
+
],
|
|
360
|
+
),
|
|
361
|
+
),
|
|
362
|
+
]);
|
|
363
|
+
}
|
|
364
|
+
|
|
343
365
|
// NOTE: this is the column name used for the dummy count() aggregate
|
|
344
366
|
// when no aggregate is specified in groupBy() or pivot()
|
|
345
367
|
const INTERNAL__FILLER_COUNT_AGG_COLUMN_NAME =
|
|
@@ -393,7 +415,7 @@ export function _pivotAggCols(
|
|
|
393
415
|
const aggCol = operation?.buildAggregateColumn(agg);
|
|
394
416
|
if (!aggCol) {
|
|
395
417
|
throw new UnsupportedOperationError(
|
|
396
|
-
`
|
|
418
|
+
`Can't build aggregate column for unsupported operator '${agg.aggregateOperator}'`,
|
|
397
419
|
);
|
|
398
420
|
}
|
|
399
421
|
return aggCol;
|
|
@@ -443,7 +465,7 @@ export function _groupByAggCols(
|
|
|
443
465
|
const aggCol = operation?.buildAggregateColumn(agg);
|
|
444
466
|
if (!aggCol) {
|
|
445
467
|
throw new UnsupportedOperationError(
|
|
446
|
-
`
|
|
468
|
+
`Can't build aggregate column for unsupported operator '${agg.aggregateOperator}'`,
|
|
447
469
|
);
|
|
448
470
|
}
|
|
449
471
|
return aggCol;
|
|
@@ -484,7 +506,7 @@ export function _groupByAggCols(
|
|
|
484
506
|
const aggCol = operation?.buildAggregateColumn(columnConfiguration);
|
|
485
507
|
if (!aggCol) {
|
|
486
508
|
throw new UnsupportedOperationError(
|
|
487
|
-
`
|
|
509
|
+
`Can't build aggregate column for unsupported operator '${columnConfiguration.aggregateOperator}'`,
|
|
488
510
|
);
|
|
489
511
|
}
|
|
490
512
|
return aggCol;
|
|
@@ -505,7 +527,7 @@ export function _groupByAggCols(
|
|
|
505
527
|
const aggCol = operation?.buildAggregateColumn(columnConfiguration);
|
|
506
528
|
if (!aggCol) {
|
|
507
529
|
throw new UnsupportedOperationError(
|
|
508
|
-
`
|
|
530
|
+
`Can't build aggregate column for unsupported operator '${columnConfiguration.aggregateOperator}'`,
|
|
509
531
|
);
|
|
510
532
|
}
|
|
511
533
|
return aggCol;
|
|
@@ -513,23 +535,6 @@ export function _groupByAggCols(
|
|
|
513
535
|
]);
|
|
514
536
|
}
|
|
515
537
|
|
|
516
|
-
export function _extendRootAggregation(columnName: string) {
|
|
517
|
-
return _function(DataCubeFunction.EXTEND, [
|
|
518
|
-
_col(
|
|
519
|
-
columnName,
|
|
520
|
-
_lambda(
|
|
521
|
-
[_var()],
|
|
522
|
-
[
|
|
523
|
-
_primitiveValue(
|
|
524
|
-
PRIMITIVE_TYPE.STRING,
|
|
525
|
-
DEFAULT_ROOT_AGGREGATION_COLUMN_VALUE,
|
|
526
|
-
),
|
|
527
|
-
],
|
|
528
|
-
),
|
|
529
|
-
),
|
|
530
|
-
]);
|
|
531
|
-
}
|
|
532
|
-
|
|
533
538
|
export function _filter(
|
|
534
539
|
filter: DataCubeQuerySnapshotFilter | DataCubeQuerySnapshotFilterCondition,
|
|
535
540
|
filterOperations: DataCubeQueryFilterOperation[],
|
|
@@ -559,7 +564,7 @@ export function _filter(
|
|
|
559
564
|
const condition = operation?.buildConditionExpression(filterCondition);
|
|
560
565
|
if (!condition) {
|
|
561
566
|
throw new UnsupportedOperationError(
|
|
562
|
-
`
|
|
567
|
+
`Can't build filter condition expression for unsupported operator '${filterCondition.operator}'`,
|
|
563
568
|
);
|
|
564
569
|
}
|
|
565
570
|
return filterCondition.not ? _not(condition) : condition;
|
|
@@ -142,11 +142,27 @@ export enum DataCubeColumnKind {
|
|
|
142
142
|
|
|
143
143
|
export enum DataCubeOperationAdvancedValueType {
|
|
144
144
|
COLUMN = 'COLUMN',
|
|
145
|
+
VOID = 'VOID',
|
|
145
146
|
// PARAMETER
|
|
146
147
|
}
|
|
147
148
|
|
|
149
|
+
export function isPrimitiveType(type: string) {
|
|
150
|
+
return (
|
|
151
|
+
[
|
|
152
|
+
PRIMITIVE_TYPE.NUMBER,
|
|
153
|
+
PRIMITIVE_TYPE.INTEGER,
|
|
154
|
+
PRIMITIVE_TYPE.DECIMAL,
|
|
155
|
+
PRIMITIVE_TYPE.FLOAT,
|
|
156
|
+
PRIMITIVE_TYPE.DATE,
|
|
157
|
+
PRIMITIVE_TYPE.STRICTDATE,
|
|
158
|
+
PRIMITIVE_TYPE.DATETIME,
|
|
159
|
+
PRIMITIVE_TYPE.STRING,
|
|
160
|
+
] as string[]
|
|
161
|
+
).includes(type);
|
|
162
|
+
}
|
|
163
|
+
|
|
148
164
|
export type DataCubeOperationValue = {
|
|
149
|
-
value
|
|
165
|
+
value?: unknown;
|
|
150
166
|
type: string;
|
|
151
167
|
};
|
|
152
168
|
|
|
@@ -31,7 +31,7 @@ import type {
|
|
|
31
31
|
import type { DataCubeColumn } from './model/DataCubeColumn.js';
|
|
32
32
|
|
|
33
33
|
export type DataCubeQuerySnapshotFilterCondition = DataCubeColumn & {
|
|
34
|
-
value: DataCubeOperationValue
|
|
34
|
+
value: DataCubeOperationValue;
|
|
35
35
|
operator: string;
|
|
36
36
|
not?: boolean | undefined;
|
|
37
37
|
};
|
|
@@ -25,20 +25,16 @@
|
|
|
25
25
|
import {
|
|
26
26
|
V1_AppliedFunction,
|
|
27
27
|
V1_CInteger,
|
|
28
|
-
type V1_ColSpec,
|
|
29
28
|
V1_Collection,
|
|
30
29
|
extractElementNameFromPath as _name,
|
|
31
30
|
matchFunctionName,
|
|
32
31
|
type V1_ValueSpecification,
|
|
32
|
+
V1_Lambda,
|
|
33
33
|
} from '@finos/legend-graph';
|
|
34
34
|
import type { DataCubeQuery } from './model/DataCubeQuery.js';
|
|
35
35
|
import { DataCubeQuerySnapshot } from './DataCubeQuerySnapshot.js';
|
|
36
36
|
import { _toCol, type DataCubeColumn } from './model/DataCubeColumn.js';
|
|
37
|
-
import {
|
|
38
|
-
assertType,
|
|
39
|
-
getNonNullableEntry,
|
|
40
|
-
guaranteeNonNullable,
|
|
41
|
-
} from '@finos/legend-shared';
|
|
37
|
+
import { assertTrue, at, guaranteeNonNullable } from '@finos/legend-shared';
|
|
42
38
|
import {
|
|
43
39
|
DataCubeQuerySortDirection,
|
|
44
40
|
DataCubeFunction,
|
|
@@ -46,15 +42,19 @@ import {
|
|
|
46
42
|
} from './DataCubeQueryEngine.js';
|
|
47
43
|
import { buildDefaultConfiguration } from './DataCubeConfigurationBuilder.js';
|
|
48
44
|
import {
|
|
49
|
-
_buildFilterSnapshot,
|
|
50
45
|
_colSpecArrayParam,
|
|
51
46
|
_colSpecParam,
|
|
52
47
|
_funcMatch,
|
|
53
|
-
_lambdaParam,
|
|
54
48
|
_param,
|
|
49
|
+
_extractExtendedColumns,
|
|
50
|
+
_filter,
|
|
51
|
+
_relationType,
|
|
52
|
+
_genericTypeParam,
|
|
53
|
+
_packageableType,
|
|
55
54
|
} from './DataCubeQuerySnapshotBuilderUtils.js';
|
|
56
55
|
import type { DataCubeSource } from './model/DataCubeSource.js';
|
|
57
56
|
import type { DataCubeQueryFilterOperation } from './filter/DataCubeQueryFilterOperation.js';
|
|
57
|
+
import type { DataCubeQueryAggregateOperation } from './aggregation/DataCubeQueryAggregateOperation.js';
|
|
58
58
|
|
|
59
59
|
// --------------------------------- BUILDING BLOCKS ---------------------------------
|
|
60
60
|
|
|
@@ -102,13 +102,13 @@ enum _FUNCTION_SEQUENCE_COMPOSITION_PART {
|
|
|
102
102
|
LIMIT = 'limit',
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
function isFunctionInValidSequence(
|
|
106
|
-
|
|
107
|
-
): value is _FUNCTION_SEQUENCE_COMPOSITION_PART {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
105
|
+
// function isFunctionInValidSequence(
|
|
106
|
+
// value: string,
|
|
107
|
+
// ): value is _FUNCTION_SEQUENCE_COMPOSITION_PART {
|
|
108
|
+
// return Object.values(_FUNCTION_SEQUENCE_COMPOSITION_PART).includes(
|
|
109
|
+
// value as _FUNCTION_SEQUENCE_COMPOSITION_PART,
|
|
110
|
+
// );
|
|
111
|
+
// }
|
|
112
112
|
|
|
113
113
|
// This corresponds to the function sequence that we currently support:
|
|
114
114
|
//
|
|
@@ -216,9 +216,7 @@ function extractFunctionMap(
|
|
|
216
216
|
): DataCubeQueryFunctionMap {
|
|
217
217
|
// Make sure this is a sequence of function calls
|
|
218
218
|
if (!(query instanceof V1_AppliedFunction)) {
|
|
219
|
-
throw new Error(
|
|
220
|
-
`Query must be a sequence of function calls (e.g. x()->y()->z())`,
|
|
221
|
-
);
|
|
219
|
+
throw new Error(`Can't process expression: Expected a function expression`);
|
|
222
220
|
}
|
|
223
221
|
const sequence: V1_AppliedFunction[] = [];
|
|
224
222
|
let currentFunc = query;
|
|
@@ -230,34 +228,30 @@ function extractFunctionMap(
|
|
|
230
228
|
|
|
231
229
|
// Check that all functions in sequence are supported (matching name and number of parameters)
|
|
232
230
|
if (!supportedFunc) {
|
|
233
|
-
throw new Error(
|
|
231
|
+
throw new Error(
|
|
232
|
+
`Can't process expression: Found unsupported function ${currentFunc.function}()`,
|
|
233
|
+
);
|
|
234
234
|
}
|
|
235
|
+
|
|
236
|
+
// recursively unwrap the nested function expression to build the function sequence,
|
|
237
|
+
// i.e. if we have the expression x(y(z(t(...)))), we need to unwrap them and build the sequence
|
|
238
|
+
// t(...)->z()->y()->x() and simultaneously, remove the first parameter from each function for
|
|
239
|
+
// simplicity, except for the innermost function
|
|
235
240
|
if (currentFunc.parameters.length > supportedFunc.parameters) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
)
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
)
|
|
249
|
-
|
|
250
|
-
sequence.unshift(currentFunc);
|
|
251
|
-
if (valueSpecification instanceof V1_AppliedFunction) {
|
|
252
|
-
currentFunc = valueSpecification;
|
|
253
|
-
} else {
|
|
254
|
-
break;
|
|
255
|
-
}
|
|
256
|
-
} else {
|
|
257
|
-
currentFunc.parameters = currentFunc.parameters.slice(1);
|
|
258
|
-
sequence.unshift(currentFunc);
|
|
259
|
-
currentFunc = valueSpecification as V1_AppliedFunction;
|
|
260
|
-
}
|
|
241
|
+
// assert that the supported function has the expected number of parameters
|
|
242
|
+
assertTrue(
|
|
243
|
+
currentFunc.parameters.length === supportedFunc.parameters + 1,
|
|
244
|
+
`Can't process ${_name(currentFunc.function)}() expression: Expected at most ${supportedFunc.parameters + 1} parameters provided, got ${currentFunc.parameters.length}`,
|
|
245
|
+
);
|
|
246
|
+
const func = _param(
|
|
247
|
+
currentFunc,
|
|
248
|
+
0,
|
|
249
|
+
V1_AppliedFunction,
|
|
250
|
+
`Can't process expression: Expected a sequence of function calls (e.g. x()->y()->z())`,
|
|
251
|
+
);
|
|
252
|
+
currentFunc.parameters = currentFunc.parameters.slice(1);
|
|
253
|
+
sequence.unshift(currentFunc);
|
|
254
|
+
currentFunc = func;
|
|
261
255
|
} else {
|
|
262
256
|
sequence.unshift(currentFunc);
|
|
263
257
|
break;
|
|
@@ -273,7 +267,7 @@ function extractFunctionMap(
|
|
|
273
267
|
);
|
|
274
268
|
if (!matchResult) {
|
|
275
269
|
throw new Error(
|
|
276
|
-
`Unsupported function composition ${sequence.map((fn) => `${_name(fn.function)}()`).join('->')} (supported composition: ${_FUNCTION_SEQUENCE_COMPOSITION_PATTERN.map((node) => `${'funcs' in node ? `[${node.funcs.map((childNode) => `${_name(childNode.func)}()`).join('->')}]` : `${_name(node.func)}()`}`).join('->')})`,
|
|
270
|
+
`Can't process expression: Unsupported function composition ${sequence.map((fn) => `${_name(fn.function)}()`).join('->')} (supported composition: ${_FUNCTION_SEQUENCE_COMPOSITION_PATTERN.map((node) => `${'funcs' in node ? `[${node.funcs.map((childNode) => `${_name(childNode.func)}()`).join('->')}]` : `${_name(node.func)}()`}`).join('->')})`,
|
|
277
271
|
);
|
|
278
272
|
}
|
|
279
273
|
|
|
@@ -286,7 +280,7 @@ function extractFunctionMap(
|
|
|
286
280
|
if (isNaN(idx) || idx >= sequence.length) {
|
|
287
281
|
return undefined;
|
|
288
282
|
}
|
|
289
|
-
const func =
|
|
283
|
+
const func = at(sequence, idx);
|
|
290
284
|
return func;
|
|
291
285
|
};
|
|
292
286
|
|
|
@@ -295,7 +289,7 @@ function extractFunctionMap(
|
|
|
295
289
|
select: _process(_FUNCTION_SEQUENCE_COMPOSITION_PART.SELECT),
|
|
296
290
|
filter: _process(_FUNCTION_SEQUENCE_COMPOSITION_PART.FILTER),
|
|
297
291
|
pivotSort: _process(_FUNCTION_SEQUENCE_COMPOSITION_PART.PIVOT_SORT),
|
|
298
|
-
pivot: _process(_FUNCTION_SEQUENCE_COMPOSITION_PART.
|
|
292
|
+
pivot: _process(_FUNCTION_SEQUENCE_COMPOSITION_PART.PIVOT),
|
|
299
293
|
pivotCast: _process(_FUNCTION_SEQUENCE_COMPOSITION_PART.PIVOT_CAST),
|
|
300
294
|
groupBy: _process(_FUNCTION_SEQUENCE_COMPOSITION_PART.GROUP_BY),
|
|
301
295
|
groupBySort: _process(_FUNCTION_SEQUENCE_COMPOSITION_PART.GROUP_BY_SORT),
|
|
@@ -317,7 +311,8 @@ export function validateAndBuildQuerySnapshot(
|
|
|
317
311
|
partialQuery: V1_ValueSpecification,
|
|
318
312
|
source: DataCubeSource,
|
|
319
313
|
baseQuery: DataCubeQuery,
|
|
320
|
-
filterOperations
|
|
314
|
+
filterOperations: DataCubeQueryFilterOperation[],
|
|
315
|
+
aggregateOperations: DataCubeQueryAggregateOperation[],
|
|
321
316
|
) {
|
|
322
317
|
// --------------------------------- BASE ---------------------------------
|
|
323
318
|
// Build the function call sequence and the function map to make the
|
|
@@ -326,28 +321,74 @@ export function validateAndBuildQuerySnapshot(
|
|
|
326
321
|
const funcMap = extractFunctionMap(partialQuery);
|
|
327
322
|
const snapshot = DataCubeQuerySnapshot.create({});
|
|
328
323
|
const data = snapshot.data;
|
|
324
|
+
const columnNames = new Set<string>();
|
|
325
|
+
/**
|
|
326
|
+
* We want to make sure all columns, either from source or created, e.g. extended columns,
|
|
327
|
+
* have unique names. This is to simplify the logic within DataCube so different components
|
|
328
|
+
* can easily refer to columns by name without having to worry about conflicts.
|
|
329
|
+
*/
|
|
330
|
+
const _checkColName = (col: DataCubeColumn, message: string) => {
|
|
331
|
+
if (columnNames.has(col.name)) {
|
|
332
|
+
throw new Error(message);
|
|
333
|
+
}
|
|
334
|
+
columnNames.add(col.name);
|
|
335
|
+
};
|
|
329
336
|
const colsMap = new Map<string, DataCubeColumn>();
|
|
330
|
-
const
|
|
337
|
+
const _getCol = (colName: string) => {
|
|
331
338
|
const column = guaranteeNonNullable(
|
|
332
|
-
colsMap.get(
|
|
333
|
-
`Can't find column '${
|
|
339
|
+
colsMap.get(colName),
|
|
340
|
+
`Can't find column '${colName}'`,
|
|
334
341
|
);
|
|
335
342
|
return _toCol(column);
|
|
336
343
|
};
|
|
344
|
+
const _setCol = (col: DataCubeColumn) => colsMap.set(col.name, col);
|
|
345
|
+
// const _unsetCol = (col: DataCubeColumn) => colsMap.delete(col.name);
|
|
337
346
|
|
|
338
347
|
// -------------------------------- SOURCE --------------------------------
|
|
339
348
|
|
|
340
349
|
data.sourceColumns = source.columns;
|
|
341
|
-
data.sourceColumns.forEach((col) =>
|
|
350
|
+
data.sourceColumns.forEach((col) => _setCol(col));
|
|
351
|
+
data.sourceColumns.forEach((col) =>
|
|
352
|
+
_checkColName(
|
|
353
|
+
col,
|
|
354
|
+
`Can't process source column '${col.name}': another column with the same name is already registered`,
|
|
355
|
+
),
|
|
356
|
+
);
|
|
342
357
|
|
|
343
358
|
// --------------------------- LEAF-LEVEL EXTEND ---------------------------
|
|
344
|
-
|
|
359
|
+
|
|
360
|
+
if (funcMap.leafExtend) {
|
|
361
|
+
// TODO: get column types (call engine to get the type)
|
|
362
|
+
data.leafExtendedColumns = _extractExtendedColumns(funcMap.leafExtend);
|
|
363
|
+
// TODO: populate the column types
|
|
364
|
+
data.leafExtendedColumns.forEach((col) => _setCol(col));
|
|
365
|
+
data.leafExtendedColumns.forEach((col) =>
|
|
366
|
+
_checkColName(
|
|
367
|
+
col,
|
|
368
|
+
`Can't process leaf-level extended column '${col.name}': another column with the same name is already registered`,
|
|
369
|
+
),
|
|
370
|
+
);
|
|
371
|
+
}
|
|
345
372
|
|
|
346
373
|
// --------------------------------- FILTER ---------------------------------
|
|
374
|
+
|
|
347
375
|
if (funcMap.filter) {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
376
|
+
// TODO: verify column presence
|
|
377
|
+
// TODO: verify column types
|
|
378
|
+
const lambda = _param(
|
|
379
|
+
funcMap.filter,
|
|
380
|
+
0,
|
|
381
|
+
V1_Lambda,
|
|
382
|
+
`Can't process filter() expression: Expected parameter at index 0 to be a lambda expression`,
|
|
383
|
+
);
|
|
384
|
+
assertTrue(
|
|
385
|
+
lambda.body.length === 1,
|
|
386
|
+
`Can't process filter() expression: Expected lambda body to have exactly 1 expression`,
|
|
387
|
+
);
|
|
388
|
+
data.filter = _filter(
|
|
389
|
+
guaranteeNonNullable(lambda.body[0]),
|
|
390
|
+
_getCol,
|
|
391
|
+
filterOperations,
|
|
351
392
|
);
|
|
352
393
|
}
|
|
353
394
|
|
|
@@ -355,28 +396,59 @@ export function validateAndBuildQuerySnapshot(
|
|
|
355
396
|
|
|
356
397
|
if (funcMap.select) {
|
|
357
398
|
data.selectColumns = _colSpecArrayParam(funcMap.select, 0).colSpecs.map(
|
|
358
|
-
(colSpec) =>
|
|
399
|
+
(colSpec) => _getCol(colSpec.name),
|
|
359
400
|
);
|
|
401
|
+
// TODO: remove columns that are not selected from colsMap
|
|
360
402
|
}
|
|
361
403
|
|
|
362
404
|
// --------------------------------- PIVOT ---------------------------------
|
|
363
|
-
|
|
405
|
+
|
|
406
|
+
if (funcMap.pivot && funcMap.pivotCast) {
|
|
407
|
+
// TODO: verify column presence
|
|
408
|
+
// TODO: verify column types
|
|
409
|
+
data.pivot = {
|
|
410
|
+
columns: _colSpecArrayParam(funcMap.pivot, 0).colSpecs.map((colSpec) =>
|
|
411
|
+
_getCol(colSpec.name),
|
|
412
|
+
),
|
|
413
|
+
castColumns: _relationType(
|
|
414
|
+
_genericTypeParam(funcMap.pivotCast, 0).genericType,
|
|
415
|
+
).columns.map((column) => ({
|
|
416
|
+
name: column.name,
|
|
417
|
+
type: _packageableType(column.genericType).fullPath,
|
|
418
|
+
})),
|
|
419
|
+
};
|
|
420
|
+
}
|
|
364
421
|
// TODO: verify groupBy agg columns, pivot agg columns and configuration agree
|
|
365
422
|
|
|
366
423
|
// --------------------------------- GROUP BY ---------------------------------
|
|
367
424
|
|
|
368
425
|
if (funcMap.groupBy) {
|
|
426
|
+
// TODO: verify column presence
|
|
427
|
+
// TODO: verify column types
|
|
369
428
|
data.groupBy = {
|
|
370
429
|
columns: _colSpecArrayParam(funcMap.groupBy, 0).colSpecs.map((colSpec) =>
|
|
371
|
-
|
|
430
|
+
_getCol(colSpec.name),
|
|
372
431
|
),
|
|
373
|
-
// TODO: verify groupBy agg columns, pivot agg columns and configuration agree
|
|
374
|
-
// TODO: verify groupBy sort columns and configuration agree
|
|
375
432
|
};
|
|
433
|
+
// TODO: verify groupBy agg columns, pivot agg columns and configuration agree
|
|
434
|
+
// TODO: verify sort columns
|
|
435
|
+
// TODO: use configuration information present in the baseQuery configuration?
|
|
376
436
|
}
|
|
377
437
|
|
|
378
438
|
// --------------------------- GROUP-LEVEL EXTEND ---------------------------
|
|
379
|
-
|
|
439
|
+
|
|
440
|
+
if (funcMap.groupExtend) {
|
|
441
|
+
// TODO: get column types (call engine to get the type)
|
|
442
|
+
data.groupExtendedColumns = _extractExtendedColumns(funcMap.groupExtend);
|
|
443
|
+
// TODO: populate the column types
|
|
444
|
+
data.groupExtendedColumns.forEach((col) => _setCol(col));
|
|
445
|
+
data.groupExtendedColumns.forEach((col) =>
|
|
446
|
+
_checkColName(
|
|
447
|
+
col,
|
|
448
|
+
`Can't process group-level extended column '${col.name}': another column with the same name is already registered`,
|
|
449
|
+
),
|
|
450
|
+
);
|
|
451
|
+
}
|
|
380
452
|
|
|
381
453
|
// --------------------------------- SORT ---------------------------------
|
|
382
454
|
|
|
@@ -388,11 +460,13 @@ export function validateAndBuildQuerySnapshot(
|
|
|
388
460
|
DataCubeFunction.DESCENDING,
|
|
389
461
|
]);
|
|
390
462
|
return {
|
|
391
|
-
...
|
|
392
|
-
direction:
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
463
|
+
..._getCol(_colSpecParam(sortColFunc, 0).name),
|
|
464
|
+
direction: matchFunctionName(
|
|
465
|
+
sortColFunc.function,
|
|
466
|
+
DataCubeFunction.ASCENDING,
|
|
467
|
+
)
|
|
468
|
+
? DataCubeQuerySortDirection.ASCENDING
|
|
469
|
+
: DataCubeQuerySortDirection.DESCENDING,
|
|
396
470
|
};
|
|
397
471
|
},
|
|
398
472
|
);
|
|
@@ -401,8 +475,12 @@ export function validateAndBuildQuerySnapshot(
|
|
|
401
475
|
// --------------------------------- LIMIT ---------------------------------
|
|
402
476
|
|
|
403
477
|
if (funcMap.limit) {
|
|
404
|
-
const value =
|
|
405
|
-
|
|
478
|
+
const value = _param(
|
|
479
|
+
funcMap.limit,
|
|
480
|
+
0,
|
|
481
|
+
V1_CInteger,
|
|
482
|
+
`Can't process limit() expression: Expected parameter at index 0 to be an integer instance value`,
|
|
483
|
+
);
|
|
406
484
|
data.limit = value.value;
|
|
407
485
|
}
|
|
408
486
|
|
|
@@ -441,13 +519,8 @@ export function validateAndBuildQuerySnapshot(
|
|
|
441
519
|
|
|
442
520
|
/**
|
|
443
521
|
* TODO: @datacube roundtrip - implement the logic to reconcile the configuration with the query
|
|
444
|
-
* - [ ] disallow naming an extended column the same as a source column/leaf-level extended column
|
|
445
|
-
* even if the column is not selected
|
|
446
522
|
* - [ ] columns (missing/extra columns - remove or generate default column configuration)
|
|
447
|
-
* - [ ]
|
|
448
|
-
* - [ ] column type
|
|
449
|
-
* - [ ] base off the type, check the settings
|
|
450
|
-
* - [ ] aggregation
|
|
523
|
+
* - [ ] base off the type and kind, check the settings to see if it's compatible
|
|
451
524
|
* - [ ] verify groupBy agg columns, pivot agg columns and configuration agree
|
|
452
525
|
* - [ ] verify groupBy sort columns and tree column sort direction configuration agree
|
|
453
526
|
*/
|