Skip to content

Commit 8419982

Browse files
committed
fix
1 parent 8d4396d commit 8419982

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

packages/cubejs-schema-compiler/src/compiler/JoinGraph.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,13 @@ export class JoinGraph {
223223

224224
protected buildJoinTreeForRoot(root: JoinHint, cubesToJoin: JoinHints): JoinTree | null {
225225
const self = this;
226+
227+
const { graph } = this;
228+
if (graph === null) {
229+
// JoinGraph was not compiled
230+
return null;
231+
}
232+
226233
if (Array.isArray(root)) {
227234
const [newRoot, ...additionalToJoin] = root;
228235
if (additionalToJoin.length > 0) {
@@ -241,11 +248,17 @@ export class JoinGraph {
241248
prevNode = toJoin;
242249
return { joins: [] };
243250
}
244-
const path = this.graph.path(prevNode, toJoin) as string[] | null;
251+
252+
const path = graph.path(prevNode, toJoin);
245253
if (!path) {
246254
return null;
247255
}
248-
const foundJoins = self.joinsByPath(path!);
256+
if (!Array.isArray(path)) {
257+
// Unexpected object return from graph, it should do so only when path cost was requested
258+
return null;
259+
}
260+
261+
const foundJoins = self.joinsByPath(path);
249262
prevNode = toJoin;
250263
nodesJoined[toJoin] = true;
251264
return { cubes: path, joins: foundJoins };

0 commit comments

Comments
 (0)