Skip to content
This repository was archived by the owner on Dec 11, 2022. It is now read-only.

Commit a988ba0

Browse files
committed
fix expend_macro function
1 parent 2fec775 commit a988ba0

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/bigquery_query.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)