Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions packages/cubejs-schema-compiler/src/compiler/CubeSymbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,27 @@ export class CubeSymbols {

get joins() {
if (!joins) {
const parentJoins = cubeDefinition.extends ? super.joins : [];
joins = [...parentJoins, ...(cubeDefinition.joins || [])];
// In dynamic models we still can hit the cases where joins are returned as map
// instead of array, so we need to convert them here to array.
// TODO: Simplify/Remove this when we drop map joins support totally.
let parentJoins = cubeDefinition.extends ? super.joins : [];
if (!Array.isArray(parentJoins)) {
parentJoins = Object.entries(parentJoins).map(([name, join]: [string, any]) => {
join.name = name;
return join as JoinDefinition;
});
}

let localJoins = cubeDefinition.joins || [];
// TODO: Simplify/Remove this when we drop map joins support totally.
if (!Array.isArray(localJoins)) {
localJoins = Object.entries(localJoins).map(([name, join]: [string, any]) => {
join.name = name;
return join as JoinDefinition;
});
}

joins = [...parentJoins, ...localJoins];
}
return joins;
},
Expand Down
Loading