@@ -63,7 +63,6 @@ export class PreAggregationPartitionRangeLoader {
6363 private readonly driverFactory : DriverFactory ,
6464 private readonly logger : any ,
6565 private readonly queryCache : QueryCache ,
66- // eslint-disable-next-line no-use-before-define
6766 private readonly preAggregations : PreAggregations ,
6867 private readonly preAggregation : PreAggregationDescription ,
6968 private readonly preAggregationsTablesToTempTables : [ string , LoadPreAggregationResult ] [ ] ,
@@ -246,7 +245,7 @@ export class PreAggregationPartitionRangeLoader {
246245 let loadResultAndLoaders = await loadPreAggregationsByPartitionRanges ( await this . partitionRanges ( ) ) ;
247246 if ( this . options . externalRefresh && loadResultAndLoaders . loadResults . length === 0 ) {
248247 loadResultAndLoaders = await loadPreAggregationsByPartitionRanges ( await this . partitionRanges ( true ) ) ;
249- // In case there're no partitions ready at matched time dimension intersection then no data can be retrieved.
248+ // In case there are no partitions ready at matched time dimension intersection then no data can be retrieved.
250249 // We need to provide any table so query can just execute successfully.
251250 if ( loadResultAndLoaders . loadResults . length > 0 ) {
252251 loadResultAndLoaders . loadResults = [ loadResultAndLoaders . loadResults [ loadResultAndLoaders . loadResults . length - 1 ] ] ;
@@ -482,11 +481,25 @@ export class PreAggregationPartitionRangeLoader {
482481 } ) ;
483482 }
484483
485- public static partitionTableName ( tableName : string , partitionGranularity : string , dateRange : string [ ] ) {
484+ public static partitionTableName ( tableName : string , partitionGranularity : string , dateRange : QueryDateRange ) {
485+ let dateLenCut : number ;
486+ switch ( partitionGranularity ) {
487+ case 'hour' :
488+ dateLenCut = 13 ;
489+ break ;
490+ case 'minute' :
491+ dateLenCut = 16 ;
492+ break ;
493+ default :
494+ dateLenCut = 10 ;
495+ break ;
496+ }
497+
486498 const partitionSuffix = dateRange [ 0 ] . substring (
487499 0 ,
488- partitionGranularity === 'hour' ? 13 : 10
500+ dateLenCut
489501 ) . replace ( / [ - T : ] / g, '' ) ;
502+
490503 return `${ tableName } ${ partitionSuffix } ` ;
491504 }
492505
0 commit comments