Skip to content

Commit 75f203e

Browse files
committed
add comments
1 parent c88ed03 commit 75f203e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

packages/cubejs-schema-compiler/src/adapter/BaseQuery.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4983,6 +4983,11 @@ export class BaseQuery {
49834983
};
49844984
}
49854985

4986+
/**
4987+
* Returns a function that constructs the full member path
4988+
* based on the query's join structure.
4989+
* @returns {(function(member: string): (string))}
4990+
*/
49864991
resolveFullMemberPathFn() {
49874992
const { root: queryJoinRoot } = this.join || {};
49884993

packages/cubejs-schema-compiler/src/adapter/PreAggregations.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,6 +1276,12 @@ export class PreAggregations {
12761276
const aggregateMeasures = preAggQuery?.fullKeyQueryAggregateMeasures({ hasMultipliedForPreAggregation: true });
12771277
references.multipliedMeasures = aggregateMeasures?.multipliedMeasures?.map(m => m.measure);
12781278
if (preAggQuery) {
1279+
// We need to build a join tree for all references, so they would always include full join path
1280+
// even for preaggregation references without join path. It is necessary to be able to match
1281+
// query and preaggregation based on full join tree. But we can not update
1282+
// references.{dimensions,measures,timeDimensions} directly, because it will break
1283+
// evaluation of references in the query on later stages.
1284+
// So we store full named members separately and use them in canUsePreAggregation functions.
12791285
references.joinTree = preAggQuery.join;
12801286
const root = references.joinTree?.root || '';
12811287
references.fullNameMeasures = references.measures.map(m => (m.startsWith(root) ? m : `${root}.${m}`));

0 commit comments

Comments
 (0)