@@ -551,16 +551,20 @@ export default class BigQueryQuery {
551551 }
552552
553553 public expend_macros ( options ) {
554+ let query = "" ;
555+ let [ hasTimeFilter , hasTimeGroup , hasTimeGroupAlias ] = [ false , false , false ] ;
556+
554557 if ( this . target . rawSql ) {
555- let q = this . target . rawSql ;
556- let hasTimeFilter , hasTimeGroup , hasTimeGroupAlias = false ;
557- q = BigQueryQuery . replaceTimeShift ( q ) ; // should also block additional partition time filtering?
558- [ q , hasTimeFilter ] = this . replaceTimeFilters ( q , options ) ;
559- [ q , hasTimeGroup ] = this . replacetimeGroupAlias ( q , true , options ) ;
560- [ q , hasTimeGroupAlias ] = this . replacetimeGroupAlias ( q , false , options ) ;
561- return [ q , hasTimeFilter || hasTimeGroup || hasTimeGroupAlias , this . target . convertToUTC ] ;
558+ query = this . target . rawSql ;
559+ query = BigQueryQuery . replaceTimeShift ( query ) ; // should also block additional partition time filtering?
560+ [ query , hasTimeFilter ] = this . replaceTimeFilters ( query , options ) ;
561+ [ query , hasTimeGroup ] = this . replacetimeGroupAlias ( query , true , options ) ;
562+ [ query , hasTimeGroupAlias ] = this . replacetimeGroupAlias ( query , false , options ) ;
562563 }
564+
565+ return [ query , hasTimeFilter || hasTimeGroup || hasTimeGroupAlias , this . target . convertToUTC ] ;
563566 }
567+
564568 public replaceTimeFilters ( q , options ) {
565569 const { from : fromD , to : toD } = options . range ;
566570 const from = this . _getDateRangePart ( fromD , this . target . convertToUTC ) ;
0 commit comments