@@ -934,8 +934,8 @@ export class BaseQuery {
934934 ) . concat ( multiStageMembers . map ( m => `SELECT * FROM ${ m . alias } ` ) ) ;
935935 }
936936
937- // Move regular measures to multiplied ones if there're same
938- // cubes to calculate. Most of the times it'll be much faster to
937+ // Move regular measures to multiplied ones if there are same
938+ // cubes to calculate. Most of the time it'll be much faster to
939939 // calculate as there will be only single scan per cube.
940940 if (
941941 regularMeasures . length &&
@@ -1448,6 +1448,24 @@ export class BaseQuery {
14481448 ) ;
14491449 }
14501450
1451+ overTimeSeriesSelect ( cumulativeMeasures , dateSeriesSql , baseQuery , dateJoinConditionSql , baseQueryAlias ) {
1452+ const forSelect = this . overTimeSeriesForSelect ( cumulativeMeasures ) ;
1453+ return `SELECT ${ forSelect } FROM ${ dateSeriesSql } ` +
1454+ ` LEFT JOIN (${ baseQuery } ) ${ this . asSyntaxJoin } ${ baseQueryAlias } ON ${ dateJoinConditionSql } ` +
1455+ this . groupByClause ( ) ;
1456+ }
1457+
1458+ overTimeSeriesForSelect ( cumulativeMeasures ) {
1459+ return this . dimensions . map ( s => s . cumulativeSelectColumns ( ) ) . concat ( this . dateSeriesSelect ( ) ) . concat (
1460+ cumulativeMeasures . map ( s => s . cumulativeSelectColumns ( ) ) ,
1461+ ) . filter ( c => ! ! c )
1462+ . join ( ', ' ) ;
1463+ }
1464+
1465+ dateSeriesSelect ( ) {
1466+ return this . timeDimensions . map ( d => d . dateSeriesSelectColumn ( ) ) ;
1467+ }
1468+
14511469 dateFromStartToEndConditionSql ( dateJoinCondition , fromRollup , isFromStartToEnd ) {
14521470 return dateJoinCondition . map (
14531471 // TODO these weird conversions to be strict typed for big query.
@@ -1472,24 +1490,6 @@ export class BaseQuery {
14721490 ) ;
14731491 }
14741492
1475- overTimeSeriesSelect ( cumulativeMeasures , dateSeriesSql , baseQuery , dateJoinConditionSql , baseQueryAlias ) {
1476- const forSelect = this . overTimeSeriesForSelect ( cumulativeMeasures ) ;
1477- return `SELECT ${ forSelect } FROM ${ dateSeriesSql } ` +
1478- ` LEFT JOIN (${ baseQuery } ) ${ this . asSyntaxJoin } ${ baseQueryAlias } ON ${ dateJoinConditionSql } ` +
1479- this . groupByClause ( ) ;
1480- }
1481-
1482- overTimeSeriesForSelect ( cumulativeMeasures ) {
1483- return this . dimensions . map ( s => s . cumulativeSelectColumns ( ) ) . concat ( this . dateSeriesSelect ( ) ) . concat (
1484- cumulativeMeasures . map ( s => s . cumulativeSelectColumns ( ) ) ,
1485- ) . filter ( c => ! ! c )
1486- . join ( ', ' ) ;
1487- }
1488-
1489- dateSeriesSelect ( ) {
1490- return this . timeDimensions . map ( d => d . dateSeriesSelectColumn ( ) ) ;
1491- }
1492-
14931493 /**
14941494 * @param {import('./BaseTimeDimension').BaseTimeDimension } timeDimension
14951495 * @return {string }
0 commit comments