@finos/legend-data-cube 0.0.43 → 0.0.44
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/docs/column-configuration.kind.md +2 -0
- package/lib/__lib__/DataCubeSetting.d.ts +1 -0
- package/lib/__lib__/DataCubeSetting.d.ts.map +1 -1
- package/lib/__lib__/DataCubeSetting.js +1 -0
- package/lib/__lib__/DataCubeSetting.js.map +1 -1
- package/lib/components/view/editor/DataCubeEditorColumnPropertiesPanel.d.ts.map +1 -1
- package/lib/components/view/editor/DataCubeEditorColumnPropertiesPanel.js +12 -6
- package/lib/components/view/editor/DataCubeEditorColumnPropertiesPanel.js.map +1 -1
- package/lib/components/view/editor/DataCubeEditorColumnSelector.d.ts +7 -1
- package/lib/components/view/editor/DataCubeEditorColumnSelector.d.ts.map +1 -1
- package/lib/components/view/editor/DataCubeEditorColumnSelector.js +23 -1
- package/lib/components/view/editor/DataCubeEditorColumnSelector.js.map +1 -1
- package/lib/components/view/editor/DataCubeEditorColumnsPanel.d.ts.map +1 -1
- package/lib/components/view/editor/DataCubeEditorColumnsPanel.js +2 -1
- package/lib/components/view/editor/DataCubeEditorColumnsPanel.js.map +1 -1
- package/lib/components/view/editor/DataCubeEditorHorizontalPivotsPanel.d.ts.map +1 -1
- package/lib/components/view/editor/DataCubeEditorHorizontalPivotsPanel.js +2 -4
- package/lib/components/view/editor/DataCubeEditorHorizontalPivotsPanel.js.map +1 -1
- package/lib/components/view/editor/DataCubeEditorSortsPanel.d.ts.map +1 -1
- package/lib/components/view/editor/DataCubeEditorSortsPanel.js +4 -25
- package/lib/components/view/editor/DataCubeEditorSortsPanel.js.map +1 -1
- package/lib/components/view/filter/DataCubeFilterEditor.d.ts.map +1 -1
- package/lib/components/view/filter/DataCubeFilterEditor.js +2 -1
- 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/package.json +5 -5
- package/lib/stores/core/DataCubeConfigurationBuilder.d.ts +4 -3
- package/lib/stores/core/DataCubeConfigurationBuilder.d.ts.map +1 -1
- package/lib/stores/core/DataCubeConfigurationBuilder.js +59 -3
- package/lib/stores/core/DataCubeConfigurationBuilder.js.map +1 -1
- package/lib/stores/core/DataCubeEngine.d.ts +2 -0
- package/lib/stores/core/DataCubeEngine.d.ts.map +1 -1
- package/lib/stores/core/DataCubeEngine.js +1 -2
- package/lib/stores/core/DataCubeEngine.js.map +1 -1
- package/lib/stores/core/DataCubeQueryBuilder.d.ts.map +1 -1
- package/lib/stores/core/DataCubeQueryBuilder.js +12 -22
- package/lib/stores/core/DataCubeQueryBuilder.js.map +1 -1
- package/lib/stores/core/DataCubeQueryBuilderUtils.d.ts +6 -5
- package/lib/stores/core/DataCubeQueryBuilderUtils.d.ts.map +1 -1
- package/lib/stores/core/DataCubeQueryBuilderUtils.js +59 -30
- package/lib/stores/core/DataCubeQueryBuilderUtils.js.map +1 -1
- package/lib/stores/core/DataCubeQueryEngine.d.ts +14 -7
- package/lib/stores/core/DataCubeQueryEngine.d.ts.map +1 -1
- package/lib/stores/core/DataCubeQueryEngine.js +76 -45
- package/lib/stores/core/DataCubeQueryEngine.js.map +1 -1
- package/lib/stores/core/DataCubeQuerySnapshot.d.ts +11 -0
- package/lib/stores/core/DataCubeQuerySnapshot.d.ts.map +1 -1
- package/lib/stores/core/DataCubeQuerySnapshot.js.map +1 -1
- package/lib/stores/core/DataCubeQuerySnapshotBuilder.d.ts +2 -3
- package/lib/stores/core/DataCubeQuerySnapshotBuilder.d.ts.map +1 -1
- package/lib/stores/core/DataCubeQuerySnapshotBuilder.js +226 -128
- package/lib/stores/core/DataCubeQuerySnapshotBuilder.js.map +1 -1
- package/lib/stores/core/DataCubeQuerySnapshotBuilderUtils.d.ts +36 -7
- package/lib/stores/core/DataCubeQuerySnapshotBuilderUtils.d.ts.map +1 -1
- package/lib/stores/core/DataCubeQuerySnapshotBuilderUtils.js +359 -126
- package/lib/stores/core/DataCubeQuerySnapshotBuilderUtils.js.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation.d.ts +10 -2
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation.d.ts.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation.js +15 -6
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation.js.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Average.d.ts +6 -2
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Average.d.ts.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Average.js +13 -3
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Average.js.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Count.d.ts +6 -2
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Count.d.ts.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Count.js +13 -3
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Count.js.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__First.d.ts +6 -2
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__First.d.ts.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__First.js +13 -3
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__First.js.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__JoinStrings.d.ts +6 -2
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__JoinStrings.d.ts.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__JoinStrings.js +23 -10
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__JoinStrings.js.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Last.d.ts +6 -2
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Last.d.ts.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Last.js +13 -3
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Last.js.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Max.d.ts +6 -2
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Max.d.ts.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Max.js +13 -3
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Max.js.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Min.d.ts +6 -2
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Min.d.ts.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Min.js +13 -3
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Min.js.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__StdDevPopulation.d.ts +6 -2
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__StdDevPopulation.d.ts.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__StdDevPopulation.js +13 -3
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__StdDevPopulation.js.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__StdDevSample.d.ts +6 -2
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__StdDevSample.d.ts.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__StdDevSample.js +13 -3
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__StdDevSample.js.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Sum.d.ts +6 -2
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Sum.d.ts.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Sum.js +14 -3
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__Sum.js.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__UniqueValue.d.ts +6 -2
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__UniqueValue.d.ts.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__UniqueValue.js +13 -3
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__UniqueValue.js.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__VariancePopulation.d.ts +6 -2
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__VariancePopulation.d.ts.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__VariancePopulation.js +13 -3
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__VariancePopulation.js.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__VarianceSample.d.ts +6 -2
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__VarianceSample.d.ts.map +1 -1
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__VarianceSample.js +13 -3
- package/lib/stores/core/aggregation/DataCubeQueryAggregateOperation__VarianceSample.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation.d.ts +0 -2
- package/lib/stores/core/filter/DataCubeQueryFilterOperation.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation.js +1 -30
- package/lib/stores/core/filter/DataCubeQueryFilterOperation.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__Contain.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__Contain.js +8 -7
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__Contain.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__ContainCaseInsensitive.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__ContainCaseInsensitive.js +10 -10
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__ContainCaseInsensitive.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EndWith.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EndWith.js +8 -7
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EndWith.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EndWithCaseInsensitive.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EndWithCaseInsensitive.js +10 -10
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EndWithCaseInsensitive.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__Equal.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__Equal.js +5 -6
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__Equal.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EqualCaseInsensitive.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EqualCaseInsensitive.js +10 -10
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EqualCaseInsensitive.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EqualCaseInsensitiveColumn.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EqualCaseInsensitiveColumn.js +6 -7
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EqualCaseInsensitiveColumn.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EqualColumn.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EqualColumn.js +6 -7
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__EqualColumn.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThan.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThan.js +5 -6
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThan.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanColumn.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanColumn.js +6 -7
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanColumn.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanOrEqual.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanOrEqual.js +5 -6
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanOrEqual.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanOrEqualColumn.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanOrEqualColumn.js +6 -7
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanOrEqualColumn.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__IsNotNull.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__IsNotNull.js +2 -6
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__IsNotNull.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__IsNull.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__IsNull.js +2 -2
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__IsNull.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThan.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThan.js +5 -6
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThan.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThanColumn.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThanColumn.js +6 -7
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThanColumn.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThanOrEqual.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThanOrEqual.js +5 -6
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThanOrEqual.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThanOrEqualColumn.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThanOrEqualColumn.js +6 -7
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__LessThanOrEqualColumn.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotContain.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotContain.js +8 -11
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotContain.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEndWith.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEndWith.js +8 -11
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEndWith.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqual.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqual.js +6 -10
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqual.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqualCaseInsensitive.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqualCaseInsensitive.js +10 -14
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqualCaseInsensitive.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqualCaseInsensitiveColumn.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqualCaseInsensitiveColumn.js +6 -11
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqualCaseInsensitiveColumn.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqualColumn.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqualColumn.js +6 -11
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotEqualColumn.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotStartWith.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotStartWith.js +8 -11
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__NotStartWith.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__StartWith.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__StartWith.js +8 -7
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__StartWith.js.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__StartWithCaseInsensitive.d.ts.map +1 -1
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__StartWithCaseInsensitive.js +10 -10
- package/lib/stores/core/filter/DataCubeQueryFilterOperation__StartWithCaseInsensitive.js.map +1 -1
- package/lib/stores/core/model/DataCubeColumn.d.ts +1 -1
- package/lib/stores/core/model/DataCubeColumn.d.ts.map +1 -1
- package/lib/stores/core/model/DataCubeColumn.js.map +1 -1
- package/lib/stores/core/model/DataCubeConfiguration.d.ts +4 -3
- package/lib/stores/core/model/DataCubeConfiguration.d.ts.map +1 -1
- package/lib/stores/core/model/DataCubeConfiguration.js +4 -0
- package/lib/stores/core/model/DataCubeConfiguration.js.map +1 -1
- package/lib/stores/services/DataCubeQuerySnapshotService.d.ts.map +1 -1
- package/lib/stores/services/DataCubeQuerySnapshotService.js +2 -2
- package/lib/stores/services/DataCubeQuerySnapshotService.js.map +1 -1
- package/lib/stores/services/DataCubeSettingService.d.ts.map +1 -1
- package/lib/stores/services/DataCubeSettingService.js +8 -0
- package/lib/stores/services/DataCubeSettingService.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.d.ts.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorColumnPropertiesPanelState.js +3 -2
- package/lib/stores/view/editor/DataCubeEditorColumnPropertiesPanelState.js.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorColumnSelectorState.d.ts +7 -0
- package/lib/stores/view/editor/DataCubeEditorColumnSelectorState.d.ts.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorColumnSelectorState.js +20 -3
- package/lib/stores/view/editor/DataCubeEditorColumnSelectorState.js.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorColumnsPanelState.d.ts.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorColumnsPanelState.js +2 -2
- package/lib/stores/view/editor/DataCubeEditorColumnsPanelState.js.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorHorizontalPivotsPanelState.d.ts +4 -4
- package/lib/stores/view/editor/DataCubeEditorHorizontalPivotsPanelState.d.ts.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorHorizontalPivotsPanelState.js +14 -8
- package/lib/stores/view/editor/DataCubeEditorHorizontalPivotsPanelState.js.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorMutableConfiguration.d.ts +1 -5
- package/lib/stores/view/editor/DataCubeEditorMutableConfiguration.d.ts.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorMutableConfiguration.js +2 -6
- package/lib/stores/view/editor/DataCubeEditorMutableConfiguration.js.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorSortsPanelState.d.ts +1 -7
- package/lib/stores/view/editor/DataCubeEditorSortsPanelState.d.ts.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorSortsPanelState.js +4 -19
- package/lib/stores/view/editor/DataCubeEditorSortsPanelState.js.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorState.d.ts.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorState.js +2 -2
- package/lib/stores/view/editor/DataCubeEditorState.js.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorVerticalPivotsPanelState.d.ts.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorVerticalPivotsPanelState.js +4 -4
- package/lib/stores/view/editor/DataCubeEditorVerticalPivotsPanelState.js.map +1 -1
- package/lib/stores/view/extend/DataCubeColumnEditorState.d.ts.map +1 -1
- package/lib/stores/view/extend/DataCubeColumnEditorState.js +2 -1
- package/lib/stores/view/extend/DataCubeColumnEditorState.js.map +1 -1
- package/lib/stores/view/extend/DataCubeExtendManagerState.d.ts.map +1 -1
- package/lib/stores/view/extend/DataCubeExtendManagerState.js +12 -12
- package/lib/stores/view/extend/DataCubeExtendManagerState.js.map +1 -1
- package/lib/stores/view/filter/DataCubeFilterEditorState.d.ts.map +1 -1
- package/lib/stores/view/filter/DataCubeFilterEditorState.js +2 -1
- package/lib/stores/view/filter/DataCubeFilterEditorState.js.map +1 -1
- package/lib/stores/view/grid/DataCubeGridClientEngine.d.ts.map +1 -1
- package/lib/stores/view/grid/DataCubeGridClientEngine.js +11 -14
- 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 +48 -12
- package/lib/stores/view/grid/DataCubeGridConfigurationBuilder.js.map +1 -1
- package/lib/stores/view/grid/DataCubeGridControllerState.d.ts +1 -1
- package/lib/stores/view/grid/DataCubeGridControllerState.d.ts.map +1 -1
- package/lib/stores/view/grid/DataCubeGridControllerState.js +20 -20
- package/lib/stores/view/grid/DataCubeGridControllerState.js.map +1 -1
- package/lib/stores/view/grid/DataCubeGridMenuBuilder.d.ts.map +1 -1
- package/lib/stores/view/grid/DataCubeGridMenuBuilder.js +8 -12
- package/lib/stores/view/grid/DataCubeGridMenuBuilder.js.map +1 -1
- package/lib/stores/view/grid/DataCubeGridQueryBuilder.js +1 -1
- package/lib/stores/view/grid/DataCubeGridQueryBuilder.js.map +1 -1
- package/lib/stores/view/grid/DataCubeGridQuerySnapshotBuilder.js +1 -1
- package/lib/stores/view/grid/DataCubeGridQuerySnapshotBuilder.js.map +1 -1
- package/package.json +8 -8
- package/src/__lib__/DataCubeSetting.ts +1 -0
- package/src/components/view/editor/DataCubeEditorColumnPropertiesPanel.tsx +40 -17
- package/src/components/view/editor/DataCubeEditorColumnSelector.tsx +75 -1
- package/src/components/view/editor/DataCubeEditorColumnsPanel.tsx +3 -6
- package/src/components/view/editor/DataCubeEditorHorizontalPivotsPanel.tsx +5 -12
- package/src/components/view/editor/DataCubeEditorSortsPanel.tsx +12 -80
- package/src/components/view/filter/DataCubeFilterEditor.tsx +2 -3
- package/src/stores/core/DataCubeConfigurationBuilder.ts +80 -5
- package/src/stores/core/DataCubeEngine.tsx +10 -2
- package/src/stores/core/DataCubeQueryBuilder.ts +36 -37
- package/src/stores/core/DataCubeQueryBuilderUtils.ts +74 -41
- package/src/stores/core/DataCubeQueryEngine.ts +120 -60
- package/src/stores/core/DataCubeQuerySnapshot.ts +13 -0
- package/src/stores/core/DataCubeQuerySnapshotBuilder.ts +379 -157
- package/src/stores/core/DataCubeQuerySnapshotBuilderUtils.ts +597 -157
- package/src/stores/core/aggregation/DataCubeQueryAggregateOperation.ts +39 -16
- package/src/stores/core/aggregation/DataCubeQueryAggregateOperation__Average.tsx +26 -4
- package/src/stores/core/aggregation/DataCubeQueryAggregateOperation__Count.tsx +26 -4
- package/src/stores/core/aggregation/DataCubeQueryAggregateOperation__First.tsx +26 -4
- package/src/stores/core/aggregation/DataCubeQueryAggregateOperation__JoinStrings.tsx +41 -26
- package/src/stores/core/aggregation/DataCubeQueryAggregateOperation__Last.tsx +26 -4
- package/src/stores/core/aggregation/DataCubeQueryAggregateOperation__Max.tsx +26 -4
- package/src/stores/core/aggregation/DataCubeQueryAggregateOperation__Min.tsx +26 -4
- package/src/stores/core/aggregation/DataCubeQueryAggregateOperation__StdDevPopulation.tsx +29 -6
- package/src/stores/core/aggregation/DataCubeQueryAggregateOperation__StdDevSample.tsx +30 -4
- package/src/stores/core/aggregation/DataCubeQueryAggregateOperation__Sum.tsx +26 -4
- package/src/stores/core/aggregation/DataCubeQueryAggregateOperation__UniqueValue.tsx +26 -4
- package/src/stores/core/aggregation/DataCubeQueryAggregateOperation__VariancePopulation.tsx +26 -4
- package/src/stores/core/aggregation/DataCubeQueryAggregateOperation__VarianceSample.tsx +26 -4
- package/src/stores/core/filter/DataCubeQueryFilterOperation.ts +1 -52
- package/src/stores/core/filter/DataCubeQueryFilterOperation__Contain.tsx +12 -9
- package/src/stores/core/filter/DataCubeQueryFilterOperation__ContainCaseInsensitive.tsx +10 -13
- package/src/stores/core/filter/DataCubeQueryFilterOperation__EndWith.tsx +9 -10
- package/src/stores/core/filter/DataCubeQueryFilterOperation__EndWithCaseInsensitive.tsx +10 -13
- package/src/stores/core/filter/DataCubeQueryFilterOperation__Equal.tsx +5 -8
- package/src/stores/core/filter/DataCubeQueryFilterOperation__EqualCaseInsensitive.tsx +10 -13
- package/src/stores/core/filter/DataCubeQueryFilterOperation__EqualCaseInsensitiveColumn.tsx +6 -8
- package/src/stores/core/filter/DataCubeQueryFilterOperation__EqualColumn.tsx +5 -7
- package/src/stores/core/filter/DataCubeQueryFilterOperation__GreaterThan.tsx +6 -9
- package/src/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanColumn.tsx +6 -8
- package/src/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanOrEqual.tsx +6 -9
- package/src/stores/core/filter/DataCubeQueryFilterOperation__GreaterThanOrEqualColumn.tsx +6 -8
- package/src/stores/core/filter/DataCubeQueryFilterOperation__IsNotNull.tsx +6 -8
- package/src/stores/core/filter/DataCubeQueryFilterOperation__IsNull.tsx +6 -2
- package/src/stores/core/filter/DataCubeQueryFilterOperation__LessThan.tsx +6 -9
- package/src/stores/core/filter/DataCubeQueryFilterOperation__LessThanColumn.tsx +6 -8
- package/src/stores/core/filter/DataCubeQueryFilterOperation__LessThanOrEqual.tsx +6 -9
- package/src/stores/core/filter/DataCubeQueryFilterOperation__LessThanOrEqualColumn.tsx +6 -8
- package/src/stores/core/filter/DataCubeQueryFilterOperation__NotContain.tsx +12 -15
- package/src/stores/core/filter/DataCubeQueryFilterOperation__NotEndWith.tsx +12 -15
- package/src/stores/core/filter/DataCubeQueryFilterOperation__NotEqual.tsx +10 -14
- package/src/stores/core/filter/DataCubeQueryFilterOperation__NotEqualCaseInsensitive.tsx +11 -20
- package/src/stores/core/filter/DataCubeQueryFilterOperation__NotEqualCaseInsensitiveColumn.tsx +7 -19
- package/src/stores/core/filter/DataCubeQueryFilterOperation__NotEqualColumn.tsx +9 -17
- package/src/stores/core/filter/DataCubeQueryFilterOperation__NotStartWith.tsx +10 -17
- package/src/stores/core/filter/DataCubeQueryFilterOperation__StartWith.tsx +9 -10
- package/src/stores/core/filter/DataCubeQueryFilterOperation__StartWithCaseInsensitive.tsx +10 -13
- package/src/stores/core/model/DataCubeColumn.ts +1 -1
- package/src/stores/core/model/DataCubeConfiguration.ts +7 -1
- package/src/stores/services/DataCubeQuerySnapshotService.ts +2 -1
- package/src/stores/services/DataCubeSettingService.tsx +8 -0
- package/src/stores/view/DataCubeViewState.ts +2 -3
- package/src/stores/view/editor/DataCubeEditorColumnPropertiesPanelState.ts +3 -2
- package/src/stores/view/editor/DataCubeEditorColumnSelectorState.ts +31 -6
- package/src/stores/view/editor/DataCubeEditorColumnsPanelState.ts +2 -7
- package/src/stores/view/editor/DataCubeEditorHorizontalPivotsPanelState.ts +33 -10
- package/src/stores/view/editor/DataCubeEditorMutableConfiguration.ts +4 -20
- package/src/stores/view/editor/DataCubeEditorSortsPanelState.ts +6 -29
- package/src/stores/view/editor/DataCubeEditorState.tsx +2 -3
- package/src/stores/view/editor/DataCubeEditorVerticalPivotsPanelState.ts +6 -7
- package/src/stores/view/extend/DataCubeColumnEditorState.tsx +2 -3
- package/src/stores/view/extend/DataCubeExtendManagerState.tsx +14 -13
- package/src/stores/view/filter/DataCubeFilterEditorState.tsx +2 -4
- package/src/stores/view/grid/DataCubeGridClientEngine.ts +21 -20
- package/src/stores/view/grid/DataCubeGridConfigurationBuilder.tsx +64 -15
- package/src/stores/view/grid/DataCubeGridControllerState.ts +35 -34
- package/src/stores/view/grid/DataCubeGridMenuBuilder.tsx +17 -23
- package/src/stores/view/grid/DataCubeGridQueryBuilder.ts +1 -1
- package/src/stores/view/grid/DataCubeGridQuerySnapshotBuilder.ts +1 -1
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
V1_ColSpec,
|
|
30
30
|
V1_ColSpecArray,
|
|
31
31
|
V1_GenericTypeInstance,
|
|
32
|
+
V1_Variable,
|
|
32
33
|
type V1_ValueSpecification,
|
|
33
34
|
V1_PrimitiveValueSpecification,
|
|
34
35
|
extractElementNameFromPath as _name,
|
|
@@ -36,15 +37,18 @@ import {
|
|
|
36
37
|
V1_RelationType,
|
|
37
38
|
V1_PackageableType,
|
|
38
39
|
type V1_GenericType,
|
|
40
|
+
V1_Collection,
|
|
41
|
+
type V1_Lambda,
|
|
39
42
|
} from '@finos/legend-graph';
|
|
40
|
-
import { type DataCubeColumn } from './model/DataCubeColumn.js';
|
|
43
|
+
import { _findCol, type DataCubeColumn } from './model/DataCubeColumn.js';
|
|
41
44
|
import {
|
|
45
|
+
assertErrorThrown,
|
|
42
46
|
assertTrue,
|
|
43
47
|
assertType,
|
|
44
48
|
at,
|
|
49
|
+
deepEqual,
|
|
45
50
|
guaranteeNonNullable,
|
|
46
51
|
guaranteeType,
|
|
47
|
-
IllegalStateError,
|
|
48
52
|
uniq,
|
|
49
53
|
UnsupportedOperationError,
|
|
50
54
|
type Clazz,
|
|
@@ -53,19 +57,60 @@ import {
|
|
|
53
57
|
DataCubeFunction,
|
|
54
58
|
DataCubeOperationAdvancedValueType,
|
|
55
59
|
DataCubeQueryFilterGroupOperator,
|
|
60
|
+
DataCubeQuerySortDirection,
|
|
61
|
+
DEFAULT_LAMBDA_VARIABLE_NAME,
|
|
56
62
|
getDataType,
|
|
63
|
+
getPivotResultColumnBaseColumnName,
|
|
64
|
+
isPivotResultColumnName,
|
|
57
65
|
TREE_COLUMN_VALUE_SEPARATOR,
|
|
58
66
|
type DataCubeOperationValue,
|
|
59
67
|
} from './DataCubeQueryEngine.js';
|
|
60
68
|
import type {
|
|
69
|
+
DataCubeQuerySnapshotAggregateColumn,
|
|
61
70
|
DataCubeQuerySnapshotFilter,
|
|
62
71
|
DataCubeQuerySnapshotFilterCondition,
|
|
72
|
+
DataCubeQuerySnapshotGroupBy,
|
|
73
|
+
DataCubeQuerySnapshotPivot,
|
|
63
74
|
} from './DataCubeQuerySnapshot.js';
|
|
64
|
-
import { _serializeValueSpecification } from './DataCubeQueryBuilderUtils.js';
|
|
65
75
|
import type { DataCubeQueryFilterOperation } from './filter/DataCubeQueryFilterOperation.js';
|
|
76
|
+
import type { DataCubeEngine } from './DataCubeEngine.js';
|
|
77
|
+
import {
|
|
78
|
+
_cols,
|
|
79
|
+
_colSpec,
|
|
80
|
+
_function,
|
|
81
|
+
_lambda,
|
|
82
|
+
_serializeValueSpecification,
|
|
83
|
+
_synthesizeMinimalSourceQuery,
|
|
84
|
+
} from './DataCubeQueryBuilderUtils.js';
|
|
85
|
+
import { INTERNAL__DataCubeSource } from './model/DataCubeSource.js';
|
|
86
|
+
import type { DataCubeQueryAggregateOperation } from './aggregation/DataCubeQueryAggregateOperation.js';
|
|
66
87
|
|
|
67
88
|
// --------------------------------- UTILITIES ---------------------------------
|
|
68
89
|
|
|
90
|
+
export function _var(variable: V1_Variable) {
|
|
91
|
+
assertTrue(
|
|
92
|
+
variable.name === DEFAULT_LAMBDA_VARIABLE_NAME,
|
|
93
|
+
`Can't process variable '${variable.name}': expected variable name to be '${DEFAULT_LAMBDA_VARIABLE_NAME}'`,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function _propertyCol(
|
|
98
|
+
property: V1_AppliedProperty,
|
|
99
|
+
columnGetter: (name: string) => DataCubeColumn,
|
|
100
|
+
) {
|
|
101
|
+
assertTrue(
|
|
102
|
+
property.parameters.length === 1,
|
|
103
|
+
`Can't process property '${property.property}': expected exactly 1 parameter`,
|
|
104
|
+
);
|
|
105
|
+
const variable = guaranteeType(
|
|
106
|
+
at(property.parameters, 0),
|
|
107
|
+
V1_Variable,
|
|
108
|
+
`Can't process property '${property.property}': failed to extract variable`,
|
|
109
|
+
);
|
|
110
|
+
_var(variable);
|
|
111
|
+
return columnGetter(property.property);
|
|
112
|
+
}
|
|
113
|
+
|
|
69
114
|
export function _param<T extends V1_ValueSpecification>(
|
|
70
115
|
func: V1_AppliedFunction,
|
|
71
116
|
paramIdx: number,
|
|
@@ -74,13 +119,13 @@ export function _param<T extends V1_ValueSpecification>(
|
|
|
74
119
|
): T {
|
|
75
120
|
assertTrue(
|
|
76
121
|
func.parameters.length >= paramIdx + 1,
|
|
77
|
-
`Can't process ${_name(func.function)}() expression:
|
|
122
|
+
`Can't process ${_name(func.function)}() expression: expected at least ${paramIdx + 1} parameter(s)`,
|
|
78
123
|
);
|
|
79
124
|
return guaranteeType(
|
|
80
125
|
func.parameters[paramIdx],
|
|
81
126
|
clazz,
|
|
82
127
|
message ??
|
|
83
|
-
`Can't process ${_name(func.function)}() expression:
|
|
128
|
+
`Can't process ${_name(func.function)}() expression: found unexpected type for parameter at index ${paramIdx}`,
|
|
84
129
|
);
|
|
85
130
|
}
|
|
86
131
|
|
|
@@ -88,7 +133,7 @@ export function _colSpecParam(func: V1_AppliedFunction, paramIdx: number) {
|
|
|
88
133
|
return guaranteeType(
|
|
89
134
|
_param(func, paramIdx, V1_ClassInstance).value,
|
|
90
135
|
V1_ColSpec,
|
|
91
|
-
`Can't process ${_name(func.function)}() expression:
|
|
136
|
+
`Can't process ${_name(func.function)}() expression: expected parameter at index ${paramIdx} to be a column specification`,
|
|
92
137
|
);
|
|
93
138
|
}
|
|
94
139
|
|
|
@@ -96,7 +141,7 @@ export function _colSpecArrayParam(func: V1_AppliedFunction, paramIdx: number) {
|
|
|
96
141
|
return guaranteeType(
|
|
97
142
|
_param(func, paramIdx, V1_ClassInstance).value,
|
|
98
143
|
V1_ColSpecArray,
|
|
99
|
-
`Can't process ${_name(func.function)}() expression:
|
|
144
|
+
`Can't process ${_name(func.function)}() expression: expected parameter at index ${paramIdx} to be a column specification list`,
|
|
100
145
|
);
|
|
101
146
|
}
|
|
102
147
|
|
|
@@ -105,10 +150,23 @@ export function _genericTypeParam(func: V1_AppliedFunction, paramIdx: number) {
|
|
|
105
150
|
func,
|
|
106
151
|
paramIdx,
|
|
107
152
|
V1_GenericTypeInstance,
|
|
108
|
-
`Can't process ${_name(func.function)}:
|
|
153
|
+
`Can't process ${_name(func.function)}: expected parameter at index ${paramIdx} to be a generic type instance`,
|
|
109
154
|
);
|
|
110
155
|
}
|
|
111
156
|
|
|
157
|
+
export function _unwrapLambda(lambda: V1_Lambda, message?: string | undefined) {
|
|
158
|
+
assertTrue(
|
|
159
|
+
lambda.body.length === 1,
|
|
160
|
+
`${message ?? `Can't process lambda`}: expected lambda body to have exactly 1 expression`,
|
|
161
|
+
);
|
|
162
|
+
assertTrue(
|
|
163
|
+
lambda.parameters.length === 1,
|
|
164
|
+
`${message ?? `Can't process lambda`}: expected lambda to have exactly 1 parameter`,
|
|
165
|
+
);
|
|
166
|
+
_var(at(lambda.parameters, 0));
|
|
167
|
+
return at(lambda.body, 0);
|
|
168
|
+
}
|
|
169
|
+
|
|
112
170
|
export function _funcMatch(
|
|
113
171
|
value: V1_ValueSpecification | undefined,
|
|
114
172
|
functionNames: string | string[],
|
|
@@ -116,14 +174,14 @@ export function _funcMatch(
|
|
|
116
174
|
assertType(
|
|
117
175
|
value,
|
|
118
176
|
V1_AppliedFunction,
|
|
119
|
-
`Can't process function:
|
|
177
|
+
`Can't process function: found unexpected value specification type`,
|
|
120
178
|
);
|
|
121
179
|
assertTrue(
|
|
122
180
|
matchFunctionName(
|
|
123
181
|
value.function,
|
|
124
182
|
Array.isArray(functionNames) ? functionNames : [functionNames],
|
|
125
183
|
),
|
|
126
|
-
`Can't process function:
|
|
184
|
+
`Can't process function: expected function to be one of [${uniq((Array.isArray(functionNames) ? functionNames : [functionNames]).map(_name)).join(', ')}]`,
|
|
127
185
|
);
|
|
128
186
|
return value;
|
|
129
187
|
}
|
|
@@ -164,7 +222,50 @@ export function _operationPrimitiveValue(
|
|
|
164
222
|
} else if (value instanceof V1_CStrictTime) {
|
|
165
223
|
return { value: value.value, type: PRIMITIVE_TYPE.STRICTTIME };
|
|
166
224
|
}
|
|
167
|
-
throw new UnsupportedOperationError(
|
|
225
|
+
throw new UnsupportedOperationError(
|
|
226
|
+
`Can't process unsupported operation primitive value`,
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export function _operationValue(
|
|
231
|
+
value: V1_ValueSpecification | undefined,
|
|
232
|
+
columnGetter: (name: string) => DataCubeColumn,
|
|
233
|
+
columnChecker?: ((column: DataCubeColumn) => void) | undefined,
|
|
234
|
+
) {
|
|
235
|
+
if (value instanceof V1_PrimitiveValueSpecification) {
|
|
236
|
+
return _operationPrimitiveValue(value);
|
|
237
|
+
} else if (value instanceof V1_AppliedProperty) {
|
|
238
|
+
const column = _propertyCol(value, columnGetter);
|
|
239
|
+
columnChecker?.(column);
|
|
240
|
+
return {
|
|
241
|
+
value: column.name,
|
|
242
|
+
type: DataCubeOperationAdvancedValueType.COLUMN,
|
|
243
|
+
};
|
|
244
|
+
} else if (value === undefined) {
|
|
245
|
+
return {
|
|
246
|
+
type: DataCubeOperationAdvancedValueType.VOID,
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
throw new UnsupportedOperationError(
|
|
250
|
+
`Can't process unsupported operation value`,
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export function _checkDuplicateColumns(
|
|
255
|
+
columns: DataCubeColumn[],
|
|
256
|
+
message?: ((colName: string) => string) | undefined,
|
|
257
|
+
) {
|
|
258
|
+
const cols = new Set<string>();
|
|
259
|
+
columns.forEach((col) => {
|
|
260
|
+
if (cols.has(col.name)) {
|
|
261
|
+
throw new Error(
|
|
262
|
+
message?.(col.name) ??
|
|
263
|
+
`Can't process expression: found duplicate columns '${col.name}'`,
|
|
264
|
+
);
|
|
265
|
+
} else {
|
|
266
|
+
cols.add(col.name);
|
|
267
|
+
}
|
|
268
|
+
});
|
|
168
269
|
}
|
|
169
270
|
|
|
170
271
|
// --------------------------------- BUILDING BLOCKS ---------------------------------
|
|
@@ -186,10 +287,8 @@ export function _pruneExpandedPaths(
|
|
|
186
287
|
let lastCommonIndex = -1;
|
|
187
288
|
for (let i = 0; i < length; i++) {
|
|
188
289
|
if (
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
guaranteeNonNullable(prevGroupByCols[i]).type !==
|
|
192
|
-
guaranteeNonNullable(currentGroupByCols[i]).type
|
|
290
|
+
at(prevGroupByCols, i).name !== at(currentGroupByCols, i).name ||
|
|
291
|
+
at(prevGroupByCols, i).type !== at(currentGroupByCols, i).type
|
|
193
292
|
) {
|
|
194
293
|
break;
|
|
195
294
|
}
|
|
@@ -203,58 +302,74 @@ export function _pruneExpandedPaths(
|
|
|
203
302
|
.sort();
|
|
204
303
|
}
|
|
205
304
|
|
|
206
|
-
export function _extractExtendedColumns(
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
//
|
|
213
|
-
|
|
214
|
-
break;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (currentFunc.parameters.length === 2) {
|
|
218
|
-
const valueSpecification = currentFunc.parameters[0];
|
|
219
|
-
if (!(valueSpecification instanceof V1_AppliedFunction)) {
|
|
220
|
-
throw new IllegalStateError(
|
|
221
|
-
`Can't process extend() expression: Expected a chain of function calls (e.g. x()->y()->z())`,
|
|
222
|
-
);
|
|
223
|
-
} else {
|
|
224
|
-
currentFunc.parameters = currentFunc.parameters.slice(1);
|
|
225
|
-
extendFuncs.unshift(currentFunc);
|
|
226
|
-
currentFunc = valueSpecification;
|
|
227
|
-
}
|
|
228
|
-
} else {
|
|
229
|
-
assertTrue(
|
|
230
|
-
currentFunc.parameters.length === 1,
|
|
231
|
-
`Can't process extend() expression: Expected 1 parameter, got ${currentFunc.parameters.length}`,
|
|
232
|
-
);
|
|
233
|
-
extendFuncs.unshift(currentFunc);
|
|
234
|
-
break;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
return extendFuncs.map((extendFunc) => {
|
|
238
|
-
const colSpecs = _colSpecArrayParam(extendFunc, 0).colSpecs;
|
|
305
|
+
export async function _extractExtendedColumns(
|
|
306
|
+
funcs: V1_AppliedFunction[],
|
|
307
|
+
currentColumns: DataCubeColumn[],
|
|
308
|
+
engine: DataCubeEngine,
|
|
309
|
+
) {
|
|
310
|
+
const colSpecs = funcs.map((extendFunc) => {
|
|
311
|
+
// TODO: support extend() with window (OLAP), this assertion will no longer work
|
|
312
|
+
const _colSpecs = _colSpecArrayParam(extendFunc, 0).colSpecs;
|
|
239
313
|
assertTrue(
|
|
240
|
-
|
|
241
|
-
`Can't process extend() expression:
|
|
314
|
+
_colSpecs.length === 1,
|
|
315
|
+
`Can't process extend() expression: expected 1 column specification, got ${_colSpecs.length}`,
|
|
242
316
|
);
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
317
|
+
return at(_colSpecs, 0);
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
// get the types
|
|
321
|
+
const sourceQuery = _synthesizeMinimalSourceQuery(currentColumns);
|
|
322
|
+
const sequence = colSpecs.map((colSpec) =>
|
|
323
|
+
_function(DataCubeFunction.EXTEND, [
|
|
324
|
+
_cols([
|
|
325
|
+
_colSpec(
|
|
326
|
+
colSpec.name,
|
|
327
|
+
guaranteeNonNullable(
|
|
328
|
+
colSpec.function1,
|
|
329
|
+
`Can't process extend() expression: expected a transformation function expression for column '${colSpec.name}'`,
|
|
330
|
+
),
|
|
331
|
+
colSpec.function2,
|
|
251
332
|
),
|
|
333
|
+
]),
|
|
334
|
+
]),
|
|
335
|
+
);
|
|
336
|
+
for (let i = 0; i < sequence.length; i++) {
|
|
337
|
+
at(sequence, i).parameters.unshift(
|
|
338
|
+
i === 0 ? sourceQuery : at(sequence, i - 1),
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
const query = at(sequence, sequence.length - 1);
|
|
342
|
+
let columns: DataCubeColumn[] = [];
|
|
343
|
+
try {
|
|
344
|
+
columns = (
|
|
345
|
+
await engine.getQueryRelationReturnType(
|
|
346
|
+
_lambda([], [query]),
|
|
347
|
+
new INTERNAL__DataCubeSource(),
|
|
348
|
+
)
|
|
349
|
+
).columns;
|
|
350
|
+
} catch (error) {
|
|
351
|
+
assertErrorThrown(error);
|
|
352
|
+
throw new Error(
|
|
353
|
+
`Can't process extend() expression: failed to retrieve type information for columns. Error: ${error.message}`,
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
return colSpecs.map((colSpec) => ({
|
|
358
|
+
name: colSpec.name,
|
|
359
|
+
type: guaranteeNonNullable(
|
|
360
|
+
_findCol(columns, colSpec.name),
|
|
361
|
+
`Can't process extend() expression: failed to retrieve type information for column '${colSpec.name}'`,
|
|
362
|
+
).type,
|
|
363
|
+
mapFn: _serializeValueSpecification(
|
|
364
|
+
guaranteeNonNullable(
|
|
365
|
+
colSpec.function1,
|
|
366
|
+
`Can't process extend() expression: expected a transformation function expression for column '${colSpec.name}'`,
|
|
252
367
|
),
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
});
|
|
368
|
+
),
|
|
369
|
+
reduceFn: colSpec.function2
|
|
370
|
+
? _serializeValueSpecification(colSpec.function2)
|
|
371
|
+
: undefined,
|
|
372
|
+
}));
|
|
258
373
|
}
|
|
259
374
|
|
|
260
375
|
export function _filter(
|
|
@@ -264,7 +379,7 @@ export function _filter(
|
|
|
264
379
|
): DataCubeQuerySnapshotFilter {
|
|
265
380
|
if (!(value instanceof V1_AppliedFunction)) {
|
|
266
381
|
throw new Error(
|
|
267
|
-
`Can't process filter() expression:
|
|
382
|
+
`Can't process filter() expression: expected a function expression`,
|
|
268
383
|
);
|
|
269
384
|
}
|
|
270
385
|
|
|
@@ -303,7 +418,7 @@ export function _unwrapNotFilterCondition(func: V1_AppliedFunction) {
|
|
|
303
418
|
);
|
|
304
419
|
assertTrue(
|
|
305
420
|
func.parameters.length === 1,
|
|
306
|
-
`Can't process not() function:
|
|
421
|
+
`Can't process not() function: expected 1 parameter`,
|
|
307
422
|
);
|
|
308
423
|
return _param(func, 0, V1_AppliedFunction);
|
|
309
424
|
}
|
|
@@ -315,7 +430,7 @@ function _filterCondition(
|
|
|
315
430
|
): DataCubeQuerySnapshotFilterCondition | DataCubeQuerySnapshotFilter {
|
|
316
431
|
if (!(value instanceof V1_AppliedFunction)) {
|
|
317
432
|
throw new UnsupportedOperationError(
|
|
318
|
-
`Can't process filter condition expression:
|
|
433
|
+
`Can't process filter condition expression: expected a function expression`,
|
|
319
434
|
);
|
|
320
435
|
}
|
|
321
436
|
|
|
@@ -375,31 +490,6 @@ function _filterCondition(
|
|
|
375
490
|
throw new Error(`Can't process filter condition: no matching operator found`);
|
|
376
491
|
}
|
|
377
492
|
|
|
378
|
-
function _filterConditionValue(
|
|
379
|
-
value: V1_ValueSpecification | undefined,
|
|
380
|
-
column: DataCubeColumn,
|
|
381
|
-
columnGetter: (name: string) => DataCubeColumn,
|
|
382
|
-
) {
|
|
383
|
-
if (value instanceof V1_PrimitiveValueSpecification) {
|
|
384
|
-
return _operationPrimitiveValue(value);
|
|
385
|
-
} else if (value instanceof V1_AppliedProperty) {
|
|
386
|
-
const column2 = columnGetter(value.property);
|
|
387
|
-
if (getDataType(column.type) !== getDataType(column2.type)) {
|
|
388
|
-
return undefined;
|
|
389
|
-
}
|
|
390
|
-
return {
|
|
391
|
-
value: column2.name,
|
|
392
|
-
type: DataCubeOperationAdvancedValueType.COLUMN,
|
|
393
|
-
};
|
|
394
|
-
} else if (value === undefined) {
|
|
395
|
-
return {
|
|
396
|
-
type: DataCubeOperationAdvancedValueType.VOID,
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
return undefined;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
493
|
/**
|
|
404
494
|
* Processes filter conditions of form: column | operator | value, e.g.
|
|
405
495
|
* $x.Age > 5
|
|
@@ -408,40 +498,50 @@ function _filterConditionValue(
|
|
|
408
498
|
* $x.Age > $x.Age2
|
|
409
499
|
* $x.Name == $x.Name2
|
|
410
500
|
*/
|
|
411
|
-
export function
|
|
412
|
-
expression: V1_AppliedFunction,
|
|
413
|
-
columnGetter: (name: string) => DataCubeColumn,
|
|
501
|
+
export function _filterCondition_base(
|
|
502
|
+
expression: V1_AppliedFunction | undefined,
|
|
414
503
|
func: string,
|
|
504
|
+
columnGetter: (name: string) => DataCubeColumn,
|
|
415
505
|
) {
|
|
416
|
-
if (
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
) {
|
|
421
|
-
|
|
422
|
-
|
|
506
|
+
if (!expression) {
|
|
507
|
+
return undefined;
|
|
508
|
+
}
|
|
509
|
+
try {
|
|
510
|
+
if (matchFunctionName(expression.function, func)) {
|
|
511
|
+
if (
|
|
512
|
+
expression.parameters.length !== 2 &&
|
|
513
|
+
expression.parameters.length !== 1
|
|
514
|
+
) {
|
|
515
|
+
return undefined;
|
|
516
|
+
}
|
|
423
517
|
|
|
424
|
-
|
|
425
|
-
expression.parameters[0] instanceof V1_AppliedProperty
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
518
|
+
let column: DataCubeColumn | undefined;
|
|
519
|
+
if (expression.parameters[0] instanceof V1_AppliedProperty) {
|
|
520
|
+
column = _propertyCol(expression.parameters[0], columnGetter);
|
|
521
|
+
}
|
|
522
|
+
if (!column) {
|
|
523
|
+
return undefined;
|
|
524
|
+
}
|
|
431
525
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
526
|
+
const value = _operationValue(
|
|
527
|
+
expression.parameters[1],
|
|
528
|
+
columnGetter,
|
|
529
|
+
(_column) => {
|
|
530
|
+
if (getDataType(column.type) !== getDataType(_column.type)) {
|
|
531
|
+
throw new Error(
|
|
532
|
+
`Can't process filter condition: found incompatible columns`,
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
);
|
|
440
537
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
538
|
+
return {
|
|
539
|
+
column,
|
|
540
|
+
value,
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
} catch {
|
|
544
|
+
return undefined;
|
|
445
545
|
}
|
|
446
546
|
return undefined;
|
|
447
547
|
}
|
|
@@ -451,58 +551,398 @@ export function _baseFilterCondition(
|
|
|
451
551
|
* $x.Name->toLower() == 'abc'->toLower()
|
|
452
552
|
* $x.Name->toLower() == $x.Name2->toLower()
|
|
453
553
|
*/
|
|
454
|
-
export function
|
|
455
|
-
expression: V1_AppliedFunction,
|
|
554
|
+
export function _filterCondition_caseSensitive(
|
|
555
|
+
expression: V1_AppliedFunction | undefined,
|
|
556
|
+
func: string,
|
|
456
557
|
columnGetter: (name: string) => DataCubeColumn,
|
|
558
|
+
) {
|
|
559
|
+
if (!expression) {
|
|
560
|
+
return undefined;
|
|
561
|
+
}
|
|
562
|
+
try {
|
|
563
|
+
if (matchFunctionName(expression.function, func)) {
|
|
564
|
+
if (expression.parameters.length !== 2) {
|
|
565
|
+
return undefined;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
const param1 = expression.parameters[0];
|
|
569
|
+
if (
|
|
570
|
+
!(param1 instanceof V1_AppliedFunction) ||
|
|
571
|
+
!matchFunctionName(param1.function, DataCubeFunction.TO_LOWERCASE)
|
|
572
|
+
) {
|
|
573
|
+
return undefined;
|
|
574
|
+
}
|
|
575
|
+
if (param1.parameters.length !== 1) {
|
|
576
|
+
return undefined;
|
|
577
|
+
}
|
|
578
|
+
let column: DataCubeColumn | undefined;
|
|
579
|
+
if (param1.parameters[0] instanceof V1_AppliedProperty) {
|
|
580
|
+
column = _propertyCol(param1.parameters[0], columnGetter);
|
|
581
|
+
}
|
|
582
|
+
if (!column) {
|
|
583
|
+
return undefined;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
const param2 = expression.parameters[1];
|
|
587
|
+
if (
|
|
588
|
+
!(param2 instanceof V1_AppliedFunction) ||
|
|
589
|
+
!matchFunctionName(param2.function, DataCubeFunction.TO_LOWERCASE)
|
|
590
|
+
) {
|
|
591
|
+
return undefined;
|
|
592
|
+
}
|
|
593
|
+
if (param2.parameters.length !== 1) {
|
|
594
|
+
return undefined;
|
|
595
|
+
}
|
|
596
|
+
const value = _operationValue(
|
|
597
|
+
param2.parameters[0],
|
|
598
|
+
columnGetter,
|
|
599
|
+
(_column) => {
|
|
600
|
+
if (getDataType(column.type) !== getDataType(_column.type)) {
|
|
601
|
+
throw new Error(
|
|
602
|
+
`Can't process filter condition: found incompatible columns`,
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
},
|
|
606
|
+
);
|
|
607
|
+
|
|
608
|
+
return {
|
|
609
|
+
column,
|
|
610
|
+
value,
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
} catch {
|
|
614
|
+
return undefined;
|
|
615
|
+
}
|
|
616
|
+
return undefined;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
export function _aggCol(
|
|
620
|
+
colSpec: V1_ColSpec,
|
|
621
|
+
columnGetter: (name: string) => DataCubeColumn,
|
|
622
|
+
aggregateOperations: DataCubeQueryAggregateOperation[],
|
|
623
|
+
) {
|
|
624
|
+
for (const operation of aggregateOperations) {
|
|
625
|
+
const col = operation.buildAggregateColumnSnapshot(colSpec, columnGetter);
|
|
626
|
+
if (col) {
|
|
627
|
+
return col;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
throw new Error(
|
|
631
|
+
`Can't process aggregate column '${colSpec.name}': no matching operator found`,
|
|
632
|
+
);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
export function _agg_base(
|
|
636
|
+
colSpec: V1_ColSpec,
|
|
457
637
|
func: string,
|
|
638
|
+
columnGetter: (name: string) => DataCubeColumn,
|
|
458
639
|
) {
|
|
459
|
-
|
|
460
|
-
if (
|
|
461
|
-
|
|
640
|
+
try {
|
|
641
|
+
if (colSpec.function1 && colSpec.function2) {
|
|
642
|
+
const mapper = _unwrapLambda(colSpec.function1);
|
|
643
|
+
const reducer = _unwrapLambda(colSpec.function2);
|
|
644
|
+
|
|
645
|
+
if (
|
|
646
|
+
mapper instanceof V1_AppliedProperty &&
|
|
647
|
+
reducer instanceof V1_AppliedFunction &&
|
|
648
|
+
reducer.parameters.length >= 1 &&
|
|
649
|
+
matchFunctionName(reducer.function, func)
|
|
650
|
+
) {
|
|
651
|
+
const column = _propertyCol(mapper, columnGetter);
|
|
652
|
+
assertTrue(
|
|
653
|
+
column.name === colSpec.name,
|
|
654
|
+
`Can't process aggregate column: column name must match mapper column name`,
|
|
655
|
+
);
|
|
656
|
+
const variable = _param(reducer, 0, V1_Variable);
|
|
657
|
+
_var(variable);
|
|
658
|
+
|
|
659
|
+
return {
|
|
660
|
+
column,
|
|
661
|
+
paramterValues: reducer.parameters
|
|
662
|
+
.slice(1)
|
|
663
|
+
.map((value) => _operationValue(value, columnGetter)),
|
|
664
|
+
};
|
|
665
|
+
}
|
|
462
666
|
}
|
|
667
|
+
} catch {
|
|
668
|
+
return undefined;
|
|
669
|
+
}
|
|
670
|
+
return undefined;
|
|
671
|
+
}
|
|
463
672
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
673
|
+
export function _pivotSort(
|
|
674
|
+
func: V1_AppliedFunction,
|
|
675
|
+
pivotColumns: DataCubeColumn[],
|
|
676
|
+
columnGetter: (name: string) => DataCubeColumn,
|
|
677
|
+
) {
|
|
678
|
+
const sortColumns = _sort(func, columnGetter);
|
|
679
|
+
const groupColumns = new Set(pivotColumns.map((col) => col.name));
|
|
680
|
+
const columnsToSort = new Set(pivotColumns.map((col) => col.name));
|
|
681
|
+
sortColumns.forEach((col) => {
|
|
682
|
+
if (groupColumns.has(col.name)) {
|
|
683
|
+
columnsToSort.delete(col.name);
|
|
684
|
+
} else {
|
|
685
|
+
throw new Error(
|
|
686
|
+
`Can't process pivot() expression: sort column '${col.name}' must be a pivot column`,
|
|
687
|
+
);
|
|
470
688
|
}
|
|
471
|
-
|
|
472
|
-
|
|
689
|
+
});
|
|
690
|
+
if (columnsToSort.size !== 0) {
|
|
691
|
+
throw new Error(
|
|
692
|
+
`Can't process pivot() expression: found unsorted pivot column(s) (${Array.from(
|
|
693
|
+
columnsToSort.values(),
|
|
694
|
+
)
|
|
695
|
+
.sort()
|
|
696
|
+
.map((col) => `'${col}'`)
|
|
697
|
+
.join(', ')})`,
|
|
698
|
+
);
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
_checkDuplicateColumns(
|
|
702
|
+
sortColumns,
|
|
703
|
+
(colName) =>
|
|
704
|
+
`Can't process pivot() expression: found duplicate sort columns '${colName}'`,
|
|
705
|
+
);
|
|
706
|
+
|
|
707
|
+
return sortColumns;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
export function _validatePivot(
|
|
711
|
+
pivot: DataCubeQuerySnapshotPivot,
|
|
712
|
+
pivotAggColumns: DataCubeQuerySnapshotAggregateColumn[],
|
|
713
|
+
availableColumns: DataCubeColumn[],
|
|
714
|
+
) {
|
|
715
|
+
// check for duplicate columns
|
|
716
|
+
const pivotColumns = pivot.columns;
|
|
717
|
+
const castColumns = pivot.castColumns;
|
|
718
|
+
_checkDuplicateColumns(
|
|
719
|
+
pivotColumns,
|
|
720
|
+
(colName) =>
|
|
721
|
+
`Can't process pivot() expression: found duplicate pivot columns '${colName}'`,
|
|
722
|
+
);
|
|
723
|
+
_checkDuplicateColumns(
|
|
724
|
+
pivotAggColumns,
|
|
725
|
+
(colName) =>
|
|
726
|
+
`Can't process pivot() expression: found duplicate aggregate columns '${colName}'`,
|
|
727
|
+
);
|
|
728
|
+
_checkDuplicateColumns(
|
|
729
|
+
castColumns,
|
|
730
|
+
(colName) =>
|
|
731
|
+
`Can't process pivot() expression: found duplicate cast columns '${colName}'`,
|
|
732
|
+
);
|
|
733
|
+
|
|
734
|
+
// check pivot columns are not aggregated on
|
|
735
|
+
pivotAggColumns.forEach((col) => {
|
|
736
|
+
if (_findCol(pivotColumns, col.name)) {
|
|
737
|
+
throw new Error(
|
|
738
|
+
`Can't process pivot() expression: pivot column '${col.name}' must not be aggregated on`,
|
|
739
|
+
);
|
|
473
740
|
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
741
|
+
});
|
|
742
|
+
|
|
743
|
+
// check cast columns
|
|
744
|
+
// NOTE: we cannot and should not do strict checks here as cast columns are dependent on the data
|
|
745
|
+
|
|
746
|
+
// check that the columns used by pivot() as group columns are present in cast columns
|
|
747
|
+
const pivotGroupColumns = availableColumns.filter(
|
|
748
|
+
(col) =>
|
|
749
|
+
!(
|
|
750
|
+
_findCol(pivotColumns, col.name) ?? _findCol(pivotAggColumns, col.name)
|
|
751
|
+
),
|
|
752
|
+
);
|
|
753
|
+
pivotGroupColumns.forEach((col) => {
|
|
754
|
+
if (!_findCol(castColumns, col.name)) {
|
|
755
|
+
throw new Error(
|
|
756
|
+
`Can't process pivot() expression: expected pivot group column '${col.name}' in cast columns`,
|
|
757
|
+
);
|
|
480
758
|
}
|
|
759
|
+
});
|
|
481
760
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
761
|
+
// check that columns used in pivot() should not show up in cast columns
|
|
762
|
+
pivotColumns.forEach((col) => {
|
|
763
|
+
if (_findCol(castColumns, col.name)) {
|
|
764
|
+
throw new Error(
|
|
765
|
+
`Can't process pivot() expression: expected pivot column '${col.name}' to not present in cast columns`,
|
|
766
|
+
);
|
|
488
767
|
}
|
|
489
|
-
|
|
490
|
-
|
|
768
|
+
});
|
|
769
|
+
pivotAggColumns.forEach((col) => {
|
|
770
|
+
if (_findCol(castColumns, col.name)) {
|
|
771
|
+
throw new Error(
|
|
772
|
+
`Can't process pivot() expression: expected pivot aggregate column '${col.name}' to not present in cast columns`,
|
|
773
|
+
);
|
|
491
774
|
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
775
|
+
});
|
|
776
|
+
|
|
777
|
+
// check that cast column resulted from an aggregation (usually has name of form VAL1__|__COL1)
|
|
778
|
+
// has a matching aggregate column (i.e. COL1)
|
|
779
|
+
castColumns
|
|
780
|
+
.filter((col) => isPivotResultColumnName(col.name))
|
|
781
|
+
.forEach((col) => {
|
|
782
|
+
const aggColName = getPivotResultColumnBaseColumnName(col.name);
|
|
783
|
+
if (!_findCol(pivotAggColumns, aggColName)) {
|
|
784
|
+
throw new Error(
|
|
785
|
+
`Can't process pivot() expression: fail to match cast column '${col.name}' to a specified aggregate column`,
|
|
786
|
+
);
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
export function _groupBySort(
|
|
792
|
+
func: V1_AppliedFunction,
|
|
793
|
+
groupByColumns: DataCubeColumn[],
|
|
794
|
+
columnGetter: (name: string) => DataCubeColumn,
|
|
795
|
+
) {
|
|
796
|
+
const sortColumns = _sort(func, columnGetter);
|
|
797
|
+
const groupColumns = new Set(groupByColumns.map((col) => col.name));
|
|
798
|
+
const columnsToSort = new Set(groupByColumns.map((col) => col.name));
|
|
799
|
+
let sortDirection: DataCubeQuerySortDirection | undefined = undefined;
|
|
800
|
+
sortColumns.forEach((col) => {
|
|
801
|
+
if (groupColumns.has(col.name)) {
|
|
802
|
+
columnsToSort.delete(col.name);
|
|
803
|
+
} else {
|
|
804
|
+
throw new Error(
|
|
805
|
+
`Can't process groupBy() expression: sort column '${col.name}' must be a group column`,
|
|
806
|
+
);
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
if (!sortDirection) {
|
|
810
|
+
sortDirection = col.direction;
|
|
811
|
+
} else if (col.direction !== sortDirection) {
|
|
812
|
+
throw new Error(
|
|
813
|
+
`Can't process groupBy() expression: all group columns must be sorted in the same direction`,
|
|
814
|
+
);
|
|
815
|
+
}
|
|
816
|
+
});
|
|
817
|
+
if (columnsToSort.size !== 0) {
|
|
818
|
+
throw new Error(
|
|
819
|
+
`Can't process groupBy() expression: found unsorted group column(s) (${Array.from(
|
|
820
|
+
columnsToSort.values(),
|
|
821
|
+
)
|
|
822
|
+
.sort()
|
|
823
|
+
.map((col) => `'${col}'`)
|
|
824
|
+
.join(', ')})`,
|
|
496
825
|
);
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
_checkDuplicateColumns(
|
|
829
|
+
sortColumns,
|
|
830
|
+
(colName) =>
|
|
831
|
+
`Can't process groupBy() expression: found duplicate sort columns '${colName}'`,
|
|
832
|
+
);
|
|
833
|
+
|
|
834
|
+
return sortColumns;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
export function _validateGroupBy(
|
|
838
|
+
groupBy: DataCubeQuerySnapshotGroupBy,
|
|
839
|
+
groupByAggColumns: DataCubeQuerySnapshotAggregateColumn[],
|
|
840
|
+
pivot: DataCubeQuerySnapshotPivot | undefined,
|
|
841
|
+
pivotAggColumns: DataCubeQuerySnapshotAggregateColumn[],
|
|
842
|
+
availableColumns: DataCubeColumn[],
|
|
843
|
+
) {
|
|
844
|
+
// check for duplicate columns
|
|
845
|
+
const groupByColumns = groupBy.columns;
|
|
846
|
+
_checkDuplicateColumns(
|
|
847
|
+
groupByColumns,
|
|
848
|
+
(colName) =>
|
|
849
|
+
`Can't process groupBy() expression: found duplicate group columns '${colName}'`,
|
|
850
|
+
);
|
|
851
|
+
_checkDuplicateColumns(
|
|
852
|
+
groupByAggColumns,
|
|
853
|
+
(colName) =>
|
|
854
|
+
`Can't process groupBy() expression: found duplicate aggregate columns '${colName}'`,
|
|
855
|
+
);
|
|
497
856
|
|
|
498
|
-
|
|
499
|
-
|
|
857
|
+
// check group columns are not aggregated on
|
|
858
|
+
groupByAggColumns.forEach((col) => {
|
|
859
|
+
if (_findCol(groupByColumns, col.name)) {
|
|
860
|
+
throw new Error(
|
|
861
|
+
`Can't process groupBy() expression: group column '${col.name}' must not be aggregated on`,
|
|
862
|
+
);
|
|
863
|
+
}
|
|
864
|
+
});
|
|
865
|
+
|
|
866
|
+
// check all available columns are either grouped on or aggregatd on
|
|
867
|
+
availableColumns.forEach((col) => {
|
|
868
|
+
if (
|
|
869
|
+
!(
|
|
870
|
+
_findCol(groupByColumns, col.name) ??
|
|
871
|
+
_findCol(groupByAggColumns, col.name)
|
|
872
|
+
)
|
|
873
|
+
) {
|
|
874
|
+
throw new Error(
|
|
875
|
+
`Can't process groupBy() expression: column '${col.name}' is neither grouped nor aggregated on`,
|
|
876
|
+
);
|
|
500
877
|
}
|
|
878
|
+
});
|
|
879
|
+
|
|
880
|
+
// check against pivot if present
|
|
881
|
+
if (pivot) {
|
|
882
|
+
const aggCols = new Map<string, DataCubeQuerySnapshotAggregateColumn>();
|
|
883
|
+
|
|
884
|
+
// check if aggregation specification is consistent (i.e. same type, operator, parameterValues)
|
|
885
|
+
// between groupBy aggregate columns
|
|
886
|
+
groupByAggColumns
|
|
887
|
+
.filter((col) => isPivotResultColumnName(col.name))
|
|
888
|
+
.forEach((col) => {
|
|
889
|
+
const aggColName = getPivotResultColumnBaseColumnName(col.name);
|
|
890
|
+
const aggCol = {
|
|
891
|
+
...col,
|
|
892
|
+
name: aggColName,
|
|
893
|
+
};
|
|
894
|
+
|
|
895
|
+
const existingAggCol = aggCols.get(aggColName);
|
|
896
|
+
|
|
897
|
+
if (!existingAggCol) {
|
|
898
|
+
aggCols.set(aggColName, aggCol);
|
|
899
|
+
} else if (!deepEqual(existingAggCol, aggCol)) {
|
|
900
|
+
throw new Error(
|
|
901
|
+
`Can't process groupBy() expression: found conflicting aggregation specification for column '${aggColName}'`,
|
|
902
|
+
);
|
|
903
|
+
}
|
|
904
|
+
});
|
|
905
|
+
|
|
906
|
+
// check if pivot() aggregate columns are consistent with groupBy() aggregate columns
|
|
907
|
+
pivotAggColumns.forEach((col) => {
|
|
908
|
+
const existingAggCol = aggCols.get(col.name);
|
|
909
|
+
if (!existingAggCol) {
|
|
910
|
+
throw new Error(
|
|
911
|
+
`Can't process groupBy() expression: column '${col.name}' is aggregated in pivot() expression but not in groupBy() expression`,
|
|
912
|
+
);
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
if (!deepEqual(existingAggCol, col)) {
|
|
916
|
+
throw new Error(
|
|
917
|
+
`Can't process groupBy() expression: found conflicting aggregation specification for column '${col.name}'`,
|
|
918
|
+
);
|
|
919
|
+
}
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
}
|
|
501
923
|
|
|
924
|
+
export function _sort(
|
|
925
|
+
func: V1_AppliedFunction,
|
|
926
|
+
columnGetter: (name: string) => DataCubeColumn,
|
|
927
|
+
) {
|
|
928
|
+
return _param(
|
|
929
|
+
func,
|
|
930
|
+
0,
|
|
931
|
+
V1_Collection,
|
|
932
|
+
`Can't process sort() expression: expected parameter at index 0 to be a collection`,
|
|
933
|
+
).values.map((value) => {
|
|
934
|
+
const sortColFunc = _funcMatch(value, [
|
|
935
|
+
DataCubeFunction.ASCENDING,
|
|
936
|
+
DataCubeFunction.DESCENDING,
|
|
937
|
+
]);
|
|
502
938
|
return {
|
|
503
|
-
|
|
504
|
-
|
|
939
|
+
...columnGetter(_colSpecParam(sortColFunc, 0).name),
|
|
940
|
+
direction: matchFunctionName(
|
|
941
|
+
sortColFunc.function,
|
|
942
|
+
DataCubeFunction.ASCENDING,
|
|
943
|
+
)
|
|
944
|
+
? DataCubeQuerySortDirection.ASCENDING
|
|
945
|
+
: DataCubeQuerySortDirection.DESCENDING,
|
|
505
946
|
};
|
|
506
|
-
}
|
|
507
|
-
return undefined;
|
|
947
|
+
});
|
|
508
948
|
}
|