Skip to content

Commit 560f7fb

Browse files
committed
improve topological sort
1 parent 94bea1c commit 560f7fb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,7 @@ export class CubeSymbols {
119119
const graph = new Map<string, GraphEdge>();
120120

121121
for (const cube of cubes) {
122-
if (!cube.isView) { // Cubes are independent
123-
graph.set(`${cube.name}-none`, [{ cubeDef: cube, name: cube.name }]);
124-
} else {
122+
if (cube.isView) {
125123
cube.cubes?.forEach(c => {
126124
const jp = c.joinPath || c.join_path; // View is not camelized yet
127125
if (jp) {
@@ -147,6 +145,12 @@ export class CubeSymbols {
147145
graph.set(`${cube.name}-${ref}`, [{ cubeDef: cube, name: cube.name }, { name: ref }]);
148146
});
149147
}
148+
} else if (cube.joins && Object.keys(cube.joins).length > 0) {
149+
Object.keys(cube.joins).forEach(j => {
150+
graph.set(`${cube.name}-${j}`, [{ cubeDef: cube, name: cube.name }, { name: j }]);
151+
});
152+
} else {
153+
graph.set(`${cube.name}-none`, [{ cubeDef: cube, name: cube.name }]);
150154
}
151155
}
152156

0 commit comments

Comments
 (0)