Skip to content

Commit cc6a5ae

Browse files
committed
simplify buildRollupJoin() and evaluatedPreAggregationObj()
1 parent c2ea506 commit cc6a5ae

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

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

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,6 @@ export type FullPreAggregationDescription = any;
9292
*/
9393
export type TransformedQuery = any;
9494

95-
type BuildRollupJoinResult = {
96-
rollupJoin: RollupJoin;
97-
existingJoins: JoinEdgeWithMembers[];
98-
};
99-
10095
export class PreAggregations {
10196
private readonly query: BaseQuery;
10297

@@ -973,7 +968,7 @@ export class PreAggregations {
973968
}
974969

975970
// TODO check multiplication factor didn't change
976-
private buildRollupJoin(preAggObj: PreAggregationForQuery, preAggObjsToJoin: PreAggregationForQuery[]): BuildRollupJoinResult {
971+
private buildRollupJoin(preAggObj: PreAggregationForQuery, preAggObjsToJoin: PreAggregationForQuery[]): RollupJoin {
977972
return this.query.cacheValue(
978973
['buildRollupJoin', JSON.stringify(preAggObj), JSON.stringify(preAggObjsToJoin)],
979974
() => {
@@ -1013,10 +1008,7 @@ export class PreAggregations {
10131008
};
10141009
});
10151010

1016-
return {
1017-
rollupJoin,
1018-
existingJoins,
1019-
};
1011+
return rollupJoin;
10201012
}
10211013
);
10221014
}
@@ -1107,19 +1099,7 @@ export class PreAggregations {
11071099
preAggregationsToJoin.forEach(preAgg => {
11081100
references.rollupsReferences.push(preAgg.references);
11091101
});
1110-
const { rollupJoin, existingJoins } = this.buildRollupJoin(preAggObj, preAggregationsToJoin);
1111-
1112-
const joinsMap: Record<string, string> = {};
1113-
for (const j of rollupJoin) {
1114-
joinsMap[j.to] = j.from;
1115-
}
1116-
for (const j of existingJoins) {
1117-
joinsMap[j.to] = j.from;
1118-
}
1119-
1120-
references.dimensions = this.buildMembersFullName(references.dimensions, joinsMap);
1121-
references.measures = this.buildMembersFullName(references.measures, joinsMap);
1122-
references.timeDimensions = this.buildTimeDimensionsFullName(references.timeDimensions, joinsMap);
1102+
const rollupJoin = this.buildRollupJoin(preAggObj, preAggregationsToJoin);
11231103

11241104
return {
11251105
...preAggObj,

0 commit comments

Comments
 (0)