From 9bfdb9c39d0acfbd52e9b27ab371907a514fa166 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 19 Aug 2025 12:59:25 +0300 Subject: [PATCH] fix(schema-compiler): Fix joins getter in cube symbols --- .../src/compiler/CubeSymbols.ts | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/packages/cubejs-schema-compiler/src/compiler/CubeSymbols.ts b/packages/cubejs-schema-compiler/src/compiler/CubeSymbols.ts index 79484ae4fac16..4d13982965169 100644 --- a/packages/cubejs-schema-compiler/src/compiler/CubeSymbols.ts +++ b/packages/cubejs-schema-compiler/src/compiler/CubeSymbols.ts @@ -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; },