Skip to content

Commit c4223ad

Browse files
committed
add comments
1 parent ac087b3 commit c4223ad

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
@@ -4771,6 +4771,11 @@ export class BaseQuery {
47714771
};
47724772
}
47734773

4774+
/**
4775+
* Returns a function that constructs the full member path
4776+
* based on the query's join structure.
4777+
* @returns {(function(member: string): (string))}
4778+
*/
47744779
resolveFullMemberPathFn() {
47754780
const { root: queryJoinRoot } = this.join || {};
47764781

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)