@finos/legend-data-cube
Version:
95 lines • 6.56 kB
TypeScript
/**
* Copyright (c) 2020-present, Goldman Sachs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { V1_AppliedFunction, V1_AppliedProperty, V1_ColSpec, V1_ColSpecArray, V1_GenericTypeInstance, V1_Variable, type V1_ValueSpecification, V1_PrimitiveValueSpecification, V1_RelationType, V1_PackageableType, type V1_GenericType, type V1_Lambda } from '@finos/legend-graph';
import { type DataCubeColumn } from './model/DataCubeColumn.js';
import { type Clazz } from '@finos/legend-shared';
import { DataCubeQuerySortDirection, type DataCubeOperationValue } from './DataCubeQueryEngine.js';
import type { DataCubeSnapshotAggregateColumn, DataCubeSnapshotFilter, DataCubeSnapshotGroupBy, DataCubeSnapshotPivot } from './DataCubeSnapshot.js';
import type { DataCubeQueryFilterOperation } from './filter/DataCubeQueryFilterOperation.js';
import type { DataCubeEngine } from './DataCubeEngine.js';
import { type DataCubeSource } from './model/DataCubeSource.js';
import type { DataCubeQueryAggregateOperation } from './aggregation/DataCubeQueryAggregateOperation.js';
export declare function _var(variable: V1_Variable): void;
export declare function _propertyCol(property: V1_AppliedProperty, columnGetter: (name: string) => DataCubeColumn): DataCubeColumn;
export declare function _param<T extends V1_ValueSpecification>(func: V1_AppliedFunction, paramIdx: number, clazz: Clazz<T>, message?: string | undefined): T;
export declare function _colSpecParam(func: V1_AppliedFunction, paramIdx: number): V1_ColSpec;
export declare function _colSpecArrayParam(func: V1_AppliedFunction, paramIdx: number): V1_ColSpecArray;
export declare function _genericTypeParam(func: V1_AppliedFunction, paramIdx: number): V1_GenericTypeInstance;
export declare function _unwrapLambda(lambda: V1_Lambda, message?: string | undefined): V1_ValueSpecification;
export declare function _funcMatch(value: V1_ValueSpecification | undefined, functionNames: string | string[]): V1_AppliedFunction;
export declare function _relationType(genericType: V1_GenericType): V1_RelationType;
export declare function _packageableType(genericType: V1_GenericType): V1_PackageableType;
export declare function _operationPrimitiveValue(value: V1_PrimitiveValueSpecification): DataCubeOperationValue;
export declare function _operationValue(value: V1_ValueSpecification | undefined, columnGetter: (name: string) => DataCubeColumn, columnChecker?: ((column: DataCubeColumn) => void) | undefined): DataCubeOperationValue;
export declare function _checkDuplicateColumns(columns: DataCubeColumn[], message?: ((colName: string) => string) | undefined): void;
/**
* This method prunes expanded paths that are no longer valid due to changes in group by columns.
* It finds the last common group by column between the previous and current group by columns and
* prune the expanded paths beyond that point.
*/
export declare function _pruneExpandedPaths(prevGroupByCols: DataCubeColumn[], currentGroupByCols: DataCubeColumn[], expandedPaths: string[]): string[];
export declare function _extractExtendedColumns(funcs: V1_AppliedFunction[], currentColumns: DataCubeColumn[], engine: DataCubeEngine, source?: DataCubeSource): Promise<{
name: string;
type: string;
mapFn: import("@finos/legend-shared").PlainObject<T>;
reduceFn: import("@finos/legend-shared").PlainObject<T> | undefined;
}[]>;
export declare function _filter(value: V1_ValueSpecification, columnGetter: (name: string) => DataCubeColumn, filterOperations: DataCubeQueryFilterOperation[]): DataCubeSnapshotFilter;
export declare function _unwrapNotFilterCondition(func: V1_AppliedFunction): V1_AppliedFunction;
/**
* Processes filter conditions of form: column | operator | value, e.g.
* $x.Age > 5
* $x.Name == 'abc'
* $x.Name->startsWith('abc')
* $x.Age > $x.Age2
* $x.Name == $x.Name2
*/
export declare function _filterCondition_base(expression: V1_AppliedFunction | undefined, func: string, columnGetter: (name: string) => DataCubeColumn): {
column: DataCubeColumn;
value: DataCubeOperationValue;
} | undefined;
/**
* Processes filter conditions of form: column (case-insensitive) | operator | value (case-insensitive), e.g.
* $x.Name->toLower() == 'abc'->toLower()
* $x.Name->toLower() == $x.Name2->toLower()
*/
export declare function _filterCondition_caseSensitive(expression: V1_AppliedFunction | undefined, func: string, columnGetter: (name: string) => DataCubeColumn): {
column: DataCubeColumn;
value: DataCubeOperationValue;
} | undefined;
export declare function _aggCol(colSpec: V1_ColSpec, columnGetter: (name: string) => DataCubeColumn, aggregateOperations: DataCubeQueryAggregateOperation[]): DataCubeSnapshotAggregateColumn;
export declare function _agg_base(colSpec: V1_ColSpec, func: string, columnGetter: (name: string) => DataCubeColumn): {
column: DataCubeColumn;
paramterValues: DataCubeOperationValue[];
} | undefined;
export declare function _pivotSort(func: V1_AppliedFunction, pivotColumns: DataCubeColumn[], columnGetter: (name: string) => DataCubeColumn): {
direction: DataCubeQuerySortDirection;
name: string;
type: string;
}[];
export declare function _validatePivot(pivot: DataCubeSnapshotPivot, pivotAggColumns: DataCubeSnapshotAggregateColumn[], availableColumns: DataCubeColumn[]): void;
export declare function _groupBySort(func: V1_AppliedFunction, groupByColumns: DataCubeColumn[], columnGetter: (name: string) => DataCubeColumn): {
direction: DataCubeQuerySortDirection;
name: string;
type: string;
}[];
export declare function _validateGroupBy(groupBy: DataCubeSnapshotGroupBy, groupByAggColumns: DataCubeSnapshotAggregateColumn[], pivot: DataCubeSnapshotPivot | undefined, pivotAggColumns: DataCubeSnapshotAggregateColumn[], availableColumns: DataCubeColumn[]): void;
export declare function _sort(func: V1_AppliedFunction, columnGetter: (name: string) => DataCubeColumn): {
direction: DataCubeQuerySortDirection;
name: string;
type: string;
}[];
//# sourceMappingURL=DataCubeSnapshotBuilderUtils.d.ts.map