@@ -204,6 +204,19 @@ describe('PreAggregations', function test() {
204
204
incremental: true,
205
205
updateWindow: '1 day'
206
206
}
207
+ },
208
+ emptyPartitioned: {
209
+ type: 'rollup',
210
+ measureReferences: [count],
211
+ timeDimensionReference: EmptyHourVisitors.createdAt,
212
+ granularity: 'hour',
213
+ partitionGranularity: 'month',
214
+ scheduledRefresh: true,
215
+ refreshKey: {
216
+ every: '1 hour',
217
+ incremental: true,
218
+ updateWindow: '1 day'
219
+ }
207
220
}
208
221
}
209
222
})
@@ -245,6 +258,11 @@ describe('PreAggregations', function test() {
245
258
}
246
259
}
247
260
})
261
+
262
+ cube('EmptyHourVisitors', {
263
+ extends: EveryHourVisitors,
264
+ sql: \`select v.* from \${visitors.sql()} v where created_at < '2000-01-01'\`
265
+ })
248
266
` ) ;
249
267
250
268
function replaceTableName ( query , preAggregation , suffix ) {
@@ -536,6 +554,40 @@ describe('PreAggregations', function test() {
536
554
} ) ;
537
555
} ) ;
538
556
557
+ it ( 'empty scheduled refresh' , ( ) => {
558
+ return compiler . compile ( ) . then ( async ( ) => {
559
+ const query = new PostgresQuery ( { joinGraph, cubeEvaluator, compiler } , {
560
+ measures : [
561
+ 'visitor_checkins.count'
562
+ ] ,
563
+ timeDimensions : [ {
564
+ dimension : 'EmptyHourVisitors.createdAt' ,
565
+ granularity : 'hour' ,
566
+ dateRange : [ '2017-01-01' , '2017-01-25' ]
567
+ } ] ,
568
+ timezone : 'UTC' ,
569
+ order : [ {
570
+ id : 'EmptyHourVisitors.createdAt'
571
+ } ] ,
572
+ preAggregationsSchema : ''
573
+ } ) ;
574
+
575
+ const preAggregations = cubeEvaluator . scheduledPreAggregations ( ) ;
576
+ const partitionedPreAgg =
577
+ preAggregations . find ( p => p . preAggregationName === 'emptyPartitioned' && p . cube === 'visitor_checkins' ) ;
578
+
579
+ const minMaxQueries = query . preAggregationStartEndQueries ( 'visitor_checkins' , partitionedPreAgg . preAggregation ) ;
580
+
581
+ console . log ( minMaxQueries ) ;
582
+
583
+ const res = await dbRunner . testQueries ( minMaxQueries ) ;
584
+
585
+ res . should . be . deepEqual (
586
+ [ { max : null } ]
587
+ ) ;
588
+ } ) ;
589
+ } ) ;
590
+
539
591
it ( 'mutable partition default refreshKey' , ( ) => {
540
592
return compiler . compile ( ) . then ( ( ) => {
541
593
const query = new PostgresQuery ( { joinGraph, cubeEvaluator, compiler } , {
0 commit comments