Skip to content

Commit 9a00ae3

Browse files
committed
more types in CubeSymbols
1 parent 4552791 commit 9a00ae3

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,10 +1058,10 @@ export class CubeSymbols implements CompilerInterface {
10581058
}
10591059

10601060
protected filterGroupFunctionDep() {
1061-
return (...filterParamArgs) => '';
1061+
return (..._filterParamArgs) => '';
10621062
}
10631063

1064-
public resolveSymbol(cubeName, name: string) {
1064+
public resolveSymbol(cubeName: string | null, name: string) {
10651065
const { sqlResolveFn, contextSymbols, collectJoinHints, depsResolveFn, currResolveIndexFn } = this.resolveSymbolsCallContext || {};
10661066
if (name === 'USER_CONTEXT') {
10671067
throw new Error('Support for USER_CONTEXT was removed, please migrate to SECURITY_CONTEXT.');
@@ -1075,20 +1075,24 @@ export class CubeSymbols implements CompilerInterface {
10751075
return symbol;
10761076
}
10771077

1078+
if (this.isCurrentCube(name) && !cubeName) {
1079+
return null;
1080+
}
1081+
10781082
// In proxied subProperty flow `name` will be set to parent dimension|measure name,
10791083
// so there will be no cube = this.symbols[cubeName : name] found, but potentially
10801084
// during cube definition evaluation some other deeper subProperty may be requested.
10811085
// To distinguish such cases we pass the right now requested property name to
10821086
// cubeReferenceProxy, so later if subProperty is requested we'll have all the required
10831087
// information to construct the response.
1084-
let cube = this.symbols[this.isCurrentCube(name) ? cubeName : name];
1088+
let cube = this.symbols[this.isCurrentCube(name) ? cubeName! : name];
10851089
if (sqlResolveFn) {
10861090
if (cube) {
10871091
cube = this.cubeReferenceProxy(
10881092
this.isCurrentCube(name) ? cubeName : name,
10891093
collectJoinHints ? [] : undefined
10901094
);
1091-
} else if (this.symbols[cubeName]?.[name]) {
1095+
} else if (cubeName && this.symbols[cubeName]?.[name]) {
10921096
cube = this.cubeReferenceProxy(
10931097
cubeName,
10941098
collectJoinHints ? [] : undefined,
@@ -1101,12 +1105,12 @@ export class CubeSymbols implements CompilerInterface {
11011105
const parentIndex = currResolveIndexFn();
11021106
cube = this.cubeDependenciesProxy(parentIndex, newCubeName);
11031107
return cube;
1104-
} else if (this.symbols[cubeName]?.[name] && this.symbols[cubeName][name].type === 'time') {
1108+
} else if (cubeName && this.symbols[cubeName]?.[name] && this.symbols[cubeName][name].type === 'time') {
11051109
const parentIndex = currResolveIndexFn();
11061110
return this.timeDimDependenciesProxy(parentIndex);
11071111
}
11081112
}
1109-
return cube || this.symbols[cubeName]?.[name];
1113+
return cube || (cubeName && this.symbols[cubeName]?.[name]);
11101114
}
11111115

11121116
protected cubeReferenceProxy(cubeName, joinHints?: any[], refProperty?: any) {

0 commit comments

Comments
 (0)