@@ -1418,7 +1418,7 @@ class BaseQuery {
1418
1418
return [
1419
1419
this . evaluateSymbolSqlWithContext (
1420
1420
( ) => this . evaluateSql ( cube , this . cubeEvaluator . cubeFromPath ( cube ) . sql ) ,
1421
- { preAggregationQuery : true }
1421
+ { preAggregationQuery : true , originalSqlPreAggregation : true }
1422
1422
) ,
1423
1423
[ ]
1424
1424
] ;
@@ -1438,14 +1438,18 @@ class BaseQuery {
1438
1438
1439
1439
preAggregationInvalidateKeyQueries ( cube , preAggregation ) {
1440
1440
const preAggregationQueryForSql = this . preAggregationQueryForSqlEvaluation ( cube , preAggregation ) ;
1441
- if ( preAggregation . refreshKey ) {
1442
- if ( preAggregation . refreshKey . sql ) {
1443
- return [ this . paramAllocator . buildSqlAndParams (
1444
- preAggregationQueryForSql . evaluateSql ( cube , preAggregation . refreshKey . sql )
1445
- ) ] ;
1446
- }
1441
+ if ( preAggregation . refreshKey && preAggregation . refreshKey . sql ) {
1442
+ return [ this . paramAllocator . buildSqlAndParams (
1443
+ preAggregationQueryForSql . evaluateSql ( cube , preAggregation . refreshKey . sql )
1444
+ ) ] ;
1447
1445
}
1448
- if ( preAggregation . partitionGranularity ) {
1446
+ if (
1447
+ preAggregation . partitionGranularity &&
1448
+ ! preAggregationQueryForSql . collectCubeNames ( ) . find ( c => {
1449
+ const fromPath = this . cubeEvaluator . cubeFromPath ( c ) ;
1450
+ return fromPath . refreshKey && fromPath . refreshKey . sql ;
1451
+ } )
1452
+ ) {
1449
1453
const cubeFromPath = this . cubeEvaluator . cubeFromPath ( cube ) ;
1450
1454
return preAggregationQueryForSql . evaluateSymbolSqlWithContext (
1451
1455
( ) => preAggregationQueryForSql . cacheKeyQueries (
@@ -1549,7 +1553,12 @@ class BaseQuery {
1549
1553
allFilters . find ( f => f . dimension === this . cubeEvaluator . pathFromArray ( [ cubeNameObj . cube , propertyName ] ) ) ;
1550
1554
return {
1551
1555
filter : ( column ) => {
1552
- if ( filter && filter . filterParams ( ) && filter . filterParams ( ) . length ) {
1556
+ if (
1557
+ filter &&
1558
+ filter . filterParams ( ) &&
1559
+ filter . filterParams ( ) . length &&
1560
+ ! this . safeEvaluateSymbolContext ( ) . originalSqlPreAggregation
1561
+ ) {
1553
1562
if ( typeof column === "function" ) {
1554
1563
return column . apply (
1555
1564
null ,
0 commit comments