Skip to content

Commit ccb6b8e

Browse files
committed
refactor(schema-compiler): Use ownedByCube instead of isView for filtering
1 parent 0f0cc59 commit ccb6b8e

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

packages/cubejs-schema-compiler/src/adapter/BaseQuery.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,12 +1733,10 @@ export class BaseQuery {
17331733
this.queryCache
17341734
);
17351735
const cubeNamesForMeasure = R.pipe(
1736-
R.map(mem => this.cubeEvaluator.parsePathAnyType(mem)[0]),
1737-
// Filtering views, because collectMemberNamesFor can return both view.dim and cube.dim
1738-
R.filter(cubeName => {
1739-
const cubeDef = this.cubeEvaluator.getCubeDefinition(cubeName);
1740-
return !cubeDef.isView;
1741-
}),
1736+
R.map(member => this.memberInstanceByPath(member)),
1737+
// collectMemberNamesFor can return both view.dim and cube.dim
1738+
R.filter(member => member.definition().ownedByCube),
1739+
R.map(member => member.cube().name),
17421740
// Single member expression can reference multiple dimensions from same cube
17431741
R.uniq,
17441742
)(
@@ -2057,12 +2055,8 @@ export class BaseQuery {
20572055
);
20582056

20592057
const nonViewMembers = memberNamesForMeasure
2060-
.filter(mem => {
2061-
const cubeName = this.cubeEvaluator.parsePathAnyType(mem)[0];
2062-
const cubeDef = this.cubeEvaluator.getCubeDefinition(cubeName);
2063-
return !cubeDef.isView;
2064-
})
2065-
.map(m => this.memberInstanceByPath(m));
2058+
.map(member => this.memberInstanceByPath(member))
2059+
.filter(member => member.definition().ownedByCube);
20662060

20672061
const cubes = this.collectFrom(nonViewMembers, this.collectCubeNamesFor.bind(this), 'collectCubeNamesFor');
20682062
const joinHints = this.collectFrom(nonViewMembers, this.collectJoinHintsFor.bind(this), 'collectJoinHintsFor');

0 commit comments

Comments
 (0)