@@ -178,6 +178,19 @@ describe('PreAggregations', function test() {
178
178
auto: {
179
179
type: 'autoRollup',
180
180
maxPreAggregations: 20
181
+ },
182
+ partitioned: {
183
+ type: 'rollup',
184
+ measureReferences: [count],
185
+ timeDimensionReference: EveryHourVisitors.createdAt,
186
+ granularity: 'day',
187
+ partitionGranularity: 'month',
188
+ scheduledRefresh: true,
189
+ refreshKey: {
190
+ every: '1 hour',
191
+ incremental: true,
192
+ updateWindow: '1 day'
193
+ }
181
194
}
182
195
}
183
196
})
@@ -471,6 +484,40 @@ describe('PreAggregations', function test() {
471
484
} ) ;
472
485
} ) ;
473
486
487
+ it ( 'partitioned scheduled refresh' , ( ) => {
488
+ return compiler . compile ( ) . then ( async ( ) => {
489
+ const query = new PostgresQuery ( { joinGraph, cubeEvaluator, compiler } , {
490
+ measures : [
491
+ 'visitor_checkins.count'
492
+ ] ,
493
+ timeDimensions : [ {
494
+ dimension : 'EveryHourVisitors.createdAt' ,
495
+ granularity : 'day' ,
496
+ dateRange : [ '2017-01-01' , '2017-01-25' ]
497
+ } ] ,
498
+ timezone : 'America/Los_Angeles' ,
499
+ order : [ {
500
+ id : 'EveryHourVisitors.createdAt'
501
+ } ] ,
502
+ preAggregationsSchema : ''
503
+ } ) ;
504
+
505
+ const preAggregations = cubeEvaluator . scheduledPreAggregations ( ) ;
506
+ const partitionedPreAgg =
507
+ preAggregations . find ( p => p . preAggregationName === 'partitioned' && p . cube === 'visitor_checkins' ) ;
508
+
509
+ const minMaxQueries = query . preAggregationStartEndQueries ( 'visitor_checkins' , partitionedPreAgg . preAggregation ) ;
510
+
511
+ console . log ( minMaxQueries ) ;
512
+
513
+ const res = await dbRunner . testQueries ( minMaxQueries ) ;
514
+
515
+ res . should . be . deepEqual (
516
+ [ { max : '2017-01-06T00:00:00.000Z' } ]
517
+ ) ;
518
+ } ) ;
519
+ } ) ;
520
+
474
521
it ( 'mutable partition default refreshKey' , ( ) => {
475
522
return compiler . compile ( ) . then ( ( ) => {
476
523
const query = new PostgresQuery ( { joinGraph, cubeEvaluator, compiler } , {
0 commit comments