From 9effea93e475bb5b540a9912d8b00a4fa211a5fa Mon Sep 17 00:00:00 2001 From: Dmitriy Rusov Date: Fri, 15 Nov 2024 10:07:21 +0100 Subject: [PATCH 1/6] dev --- packages/cubejs-schema-compiler/src/adapter/PreAggregations.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js b/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js index 4495281416a00..4919508583625 100644 --- a/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js +++ b/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js @@ -166,7 +166,7 @@ export class PreAggregations { return false; } - if (td.dimension === foundPreAggregation.references.timeDimensions[0].dimension) { + if (td.dimension?.split('.')[1] === foundPreAggregation.references.timeDimensions[0].dimension?.split('.')[1]) { return true; } From ec59f57043329b672d55b67e0155c8ada6950501 Mon Sep 17 00:00:00 2001 From: Dmitriy Rusov Date: Fri, 15 Nov 2024 19:44:30 +0100 Subject: [PATCH 2/6] fix --- .../cubejs-schema-compiler/src/adapter/PreAggregations.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js b/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js index 4919508583625..a88cee254806d 100644 --- a/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js +++ b/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js @@ -166,7 +166,11 @@ export class PreAggregations { return false; } - if (td.dimension?.split('.')[1] === foundPreAggregation.references.timeDimensions[0].dimension?.split('.')[1]) { + if (td.dimension === foundPreAggregation.references.timeDimensions[0].dimension) { + return true; + } + + if (td.dimension === preAggregation.rollupLambdaTimeDimensionReference?.[0]?.dimension) { return true; } @@ -974,6 +978,7 @@ export class PreAggregations { unionWithSourceData: i === referencedPreAggregations.length - 1 ? preAggObj.preAggregation.unionWithSourceData : false, rollupLambdaId: `${cube}.${preAggregationName}`, lastRollupLambda: i === referencedPreAggregations.length - 1, + rollupLambdaTimeDimensionReference: preAggObj.references.timeDimensions, } }; if (i > 0) { From e2491cbfee927d858f113da20d6ea506380b260a Mon Sep 17 00:00:00 2001 From: Dmitriy Rusov Date: Fri, 15 Nov 2024 19:46:10 +0100 Subject: [PATCH 3/6] clear --- packages/cubejs-schema-compiler/src/adapter/PreAggregations.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js b/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js index a88cee254806d..95304eb8b952c 100644 --- a/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js +++ b/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js @@ -170,7 +170,7 @@ export class PreAggregations { return true; } - if (td.dimension === preAggregation.rollupLambdaTimeDimensionReference?.[0]?.dimension) { + if (td.dimension === foundPreAggregation.preAggregation.rollupLambdaTimeDimensionReference?.[0]?.dimension) { return true; } From 60c543aeb8ba17ff1b02d20fcdc288527e9e56ae Mon Sep 17 00:00:00 2001 From: Dmitriy Rusov Date: Fri, 15 Nov 2024 19:47:15 +0100 Subject: [PATCH 4/6] clear --- .../cubejs-schema-compiler/src/adapter/PreAggregations.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js b/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js index 95304eb8b952c..2b3f4e7302205 100644 --- a/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js +++ b/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js @@ -166,10 +166,6 @@ export class PreAggregations { return false; } - if (td.dimension === foundPreAggregation.references.timeDimensions[0].dimension) { - return true; - } - if (td.dimension === foundPreAggregation.preAggregation.rollupLambdaTimeDimensionReference?.[0]?.dimension) { return true; } From dcbef02e2a7fe40650587bcc4398b7113edf6915 Mon Sep 17 00:00:00 2001 From: Dmitriy Rusov Date: Fri, 15 Nov 2024 20:04:36 +0100 Subject: [PATCH 5/6] fix --- .../cubejs-schema-compiler/src/adapter/PreAggregations.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js b/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js index 2b3f4e7302205..1009d80ea7583 100644 --- a/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js +++ b/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js @@ -166,12 +166,16 @@ export class PreAggregations { return false; } - if (td.dimension === foundPreAggregation.preAggregation.rollupLambdaTimeDimensionReference?.[0]?.dimension) { + const timeDimensionsReferences = + foundPreAggregation.preAggregation.rollupLambdaTimeDimensionReference || + foundPreAggregation.references.timeDimensions; + + if (td.dimension === timeDimensionsReferences[0].dimension) { return true; } // Handling for views - return td.dimension === allBackAliasMembers[foundPreAggregation.references.timeDimensions[0].dimension]; + return td.dimension === allBackAliasMembers[timeDimensionsReferences[0].dimension]; }); const filters = preAggregation.partitionGranularity && this.query.filters.filter(td => { From a5fd5dfbfaee44b48c1b9e1b79f9e8c295f556c2 Mon Sep 17 00:00:00 2001 From: Dmitriy Rusov Date: Fri, 15 Nov 2024 20:19:19 +0100 Subject: [PATCH 6/6] clear --- .../src/adapter/PreAggregations.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js b/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js index 1009d80ea7583..5f2b668cb0843 100644 --- a/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js +++ b/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js @@ -166,16 +166,16 @@ export class PreAggregations { return false; } - const timeDimensionsReferences = - foundPreAggregation.preAggregation.rollupLambdaTimeDimensionReference || + const timeDimensionsReference = + foundPreAggregation.preAggregation.rollupLambdaTimeDimensionsReference || foundPreAggregation.references.timeDimensions; - if (td.dimension === timeDimensionsReferences[0].dimension) { + if (td.dimension === timeDimensionsReference[0].dimension) { return true; } // Handling for views - return td.dimension === allBackAliasMembers[timeDimensionsReferences[0].dimension]; + return td.dimension === allBackAliasMembers[timeDimensionsReference[0].dimension]; }); const filters = preAggregation.partitionGranularity && this.query.filters.filter(td => { @@ -978,7 +978,7 @@ export class PreAggregations { unionWithSourceData: i === referencedPreAggregations.length - 1 ? preAggObj.preAggregation.unionWithSourceData : false, rollupLambdaId: `${cube}.${preAggregationName}`, lastRollupLambda: i === referencedPreAggregations.length - 1, - rollupLambdaTimeDimensionReference: preAggObj.references.timeDimensions, + rollupLambdaTimeDimensionsReference: preAggObj.references.timeDimensions, } }; if (i > 0) {