@@ -945,8 +945,8 @@ export class BaseQuery {
945945 ) . concat ( multiStageMembers . map ( m => `SELECT * FROM ${ m . alias } ` ) ) ;
946946 }
947947
948- // Move regular measures to multiplied ones if there're same
949- // cubes to calculate. Most of the times it'll be much faster to
948+ // Move regular measures to multiplied ones if there are same
949+ // cubes to calculate. Most of the time it'll be much faster to
950950 // calculate as there will be only single scan per cube.
951951 if (
952952 regularMeasures . length &&
@@ -1499,6 +1499,24 @@ export class BaseQuery {
14991499 ) ;
15001500 }
15011501
1502+ overTimeSeriesSelect ( cumulativeMeasures , dateSeriesSql , baseQuery , dateJoinConditionSql , baseQueryAlias ) {
1503+ const forSelect = this . overTimeSeriesForSelect ( cumulativeMeasures ) ;
1504+ return `SELECT ${ forSelect } FROM ${ dateSeriesSql } ` +
1505+ ` LEFT JOIN (${ baseQuery } ) ${ this . asSyntaxJoin } ${ baseQueryAlias } ON ${ dateJoinConditionSql } ` +
1506+ this . groupByClause ( ) ;
1507+ }
1508+
1509+ overTimeSeriesForSelect ( cumulativeMeasures ) {
1510+ return this . dimensions . map ( s => s . cumulativeSelectColumns ( ) ) . concat ( this . dateSeriesSelect ( ) ) . concat (
1511+ cumulativeMeasures . map ( s => s . cumulativeSelectColumns ( ) ) ,
1512+ ) . filter ( c => ! ! c )
1513+ . join ( ', ' ) ;
1514+ }
1515+
1516+ dateSeriesSelect ( ) {
1517+ return this . timeDimensions . map ( d => d . dateSeriesSelectColumn ( ) ) ;
1518+ }
1519+
15021520 dateFromStartToEndConditionSql ( dateJoinCondition , fromRollup , isFromStartToEnd ) {
15031521 return dateJoinCondition . map (
15041522 // TODO these weird conversions to be strict typed for big query.
@@ -1523,24 +1541,6 @@ export class BaseQuery {
15231541 ) ;
15241542 }
15251543
1526- overTimeSeriesSelect ( cumulativeMeasures , dateSeriesSql , baseQuery , dateJoinConditionSql , baseQueryAlias ) {
1527- const forSelect = this . overTimeSeriesForSelect ( cumulativeMeasures ) ;
1528- return `SELECT ${ forSelect } FROM ${ dateSeriesSql } ` +
1529- ` LEFT JOIN (${ baseQuery } ) ${ this . asSyntaxJoin } ${ baseQueryAlias } ON ${ dateJoinConditionSql } ` +
1530- this . groupByClause ( ) ;
1531- }
1532-
1533- overTimeSeriesForSelect ( cumulativeMeasures ) {
1534- return this . dimensions . map ( s => s . cumulativeSelectColumns ( ) ) . concat ( this . dateSeriesSelect ( ) ) . concat (
1535- cumulativeMeasures . map ( s => s . cumulativeSelectColumns ( ) ) ,
1536- ) . filter ( c => ! ! c )
1537- . join ( ', ' ) ;
1538- }
1539-
1540- dateSeriesSelect ( ) {
1541- return this . timeDimensions . map ( d => d . dateSeriesSelectColumn ( ) ) ;
1542- }
1543-
15441544 /**
15451545 * @param {import('./BaseTimeDimension').BaseTimeDimension } timeDimension
15461546 * @return {string }
0 commit comments