@@ -17,7 +17,13 @@ import { BaseSegment } from './BaseSegment';
1717
1818export type RollupJoin = any ;
1919
20- export type PreAggregationDefinitionExtended = PreAggregationDefinition & {
20+ export type PartitionTimeDimension = {
21+ dimension : string ;
22+ dateRange : [ string , string ] ;
23+ boundaryDateRange : [ string , string ] ;
24+ } ;
25+
26+ export type PreAggregationDefinitionExtended = PreAggregationDefinition & PreAggregationReferences & {
2127 unionWithSourceData : boolean ;
2228 rollupLambdaId : string ;
2329 lastRollupLambda : boolean ;
@@ -27,6 +33,7 @@ export type PreAggregationDefinitionExtended = PreAggregationDefinition & {
2733 streamOffset : 'earliest' | 'latest' ;
2834 uniqueKeyColumns : string ;
2935 sqlAlias ?: string ;
36+ partitionTimeDimensions ?: PartitionTimeDimension [ ] ;
3037} ;
3138
3239export type PreAggregationForQuery = {
@@ -587,7 +594,7 @@ export class PreAggregations {
587594 . dimensions
588595 . map ( d => CubeSymbols . joinHintFromPath ( d ) . path ) ;
589596 const multipliedMeasuresTrimmed = references
590- . multipliedMeasures ?. map ( m => CubeSymbols . joinHintFromPath ( m ) . path ) ;
597+ . multipliedMeasures ?. map ( m => CubeSymbols . joinHintFromPath ( m ) . path ) || [ ] ;
591598
592599 return {
593600 ...references ,
@@ -735,7 +742,7 @@ export class PreAggregations {
735742 if ( referencesTrimmed . multipliedMeasures ) {
736743 const backAliasMultipliedMeasures = backAlias ( referencesTrimmed . multipliedMeasures ) ;
737744
738- if ( transformedQuery . leafMeasures . some ( m => referencesTrimmed . multipliedMeasures . includes ( m ) ) ||
745+ if ( transformedQuery . leafMeasures . some ( m => referencesTrimmed . multipliedMeasures ? .includes ( m ) ) ||
739746 transformedQuery . measures . some ( m => backAliasMultipliedMeasures . includes ( m ) )
740747 ) {
741748 return false ;
@@ -1213,7 +1220,7 @@ export class PreAggregations {
12131220 ) ;
12141221 }
12151222
1216- public rollupPreAggregationQuery ( cube : string , aggregation : PreAggregationDefinition , context : EvaluateReferencesContext = { } ) : BaseQuery {
1223+ public rollupPreAggregationQuery ( cube : string , aggregation : PreAggregationDefinitionExtended , context : EvaluateReferencesContext = { } ) : BaseQuery {
12171224 // `this.evaluateAllReferences` will retain not only members, but their join path as well, and pass join hints
12181225 // to subquery. Otherwise, members in subquery would regenerate new join tree from clean state,
12191226 // and it can be different from expected by join path in pre-aggregation declaration
@@ -1245,7 +1252,7 @@ export class PreAggregations {
12451252 } ) ;
12461253 }
12471254
1248- public autoRollupPreAggregationQuery ( cube : string , aggregation : PreAggregationDefinition ) : BaseQuery {
1255+ public autoRollupPreAggregationQuery ( cube : string , aggregation : PreAggregationDefinitionExtended ) : BaseQuery {
12491256 return this . query . newSubQueryForCube (
12501257 cube ,
12511258 {
@@ -1261,7 +1268,7 @@ export class PreAggregations {
12611268 ) ;
12621269 }
12631270
1264- private mergePartitionTimeDimensions ( aggregation : PreAggregationReferences , partitionTimeDimensions : BaseTimeDimension [ ] ) {
1271+ private mergePartitionTimeDimensions ( aggregation : PreAggregationReferences , partitionTimeDimensions ?: PartitionTimeDimension [ ] ) {
12651272 if ( ! partitionTimeDimensions ) {
12661273 return aggregation . timeDimensions ;
12671274 }
@@ -1286,7 +1293,7 @@ export class PreAggregations {
12861293 . toLowerCase ( ) ;
12871294 }
12881295
1289- private evaluateAllReferences ( cube : string , aggregation : PreAggregationDefinition , preAggregationName : string | null = null , context : EvaluateReferencesOptions = { } ) : PreAggregationReferences {
1296+ private evaluateAllReferences ( cube : string , aggregation : PreAggregationDefinition , preAggregationName : string | null = null , context : EvaluateReferencesContext = { } ) : PreAggregationReferences {
12901297 // TODO build a join tree for all references, so they would always include full join path
12911298 // Even for preaggregation references without join path
12921299 // It is necessary to be able to match query and preaggregation based on full join tree
0 commit comments