Skip to content

Commit 042ba7d

Browse files
committed
move guard to the filter_params proxy
1 parent 1a9b1f4 commit 042ba7d

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2241,13 +2241,6 @@ export class BaseQuery {
22412241
}
22422242
}
22432243

2244-
// This is a special recursion guard that might happen sometimes, like
2245-
// during alias members collection which invokes sql evaluation of all members
2246-
// when FILTER_PARAMS is proxied for SQL evaluation.
2247-
if (parentMember === memberPath && this.safeEvaluateSymbolContext().aliasGathering) {
2248-
return '';
2249-
}
2250-
22512244
this.safeEvaluateSymbolContext().currentMember = memberPath;
22522245
try {
22532246
if (type === 'measure') {
@@ -3895,10 +3888,11 @@ export class BaseQuery {
38953888
// allBackAliasMembersExceptSegments() -> collectFrom() -> traverseSymbol() -> evaluateSymbolSql() ->
38963889
// autoPrefixAndEvaluateSql() -> evaluateSql() -> filterProxyFromAllFilters->Proxy->toString()
38973890
// and so on...
3898-
// For this case there is a recursion guard added to this.evaluateSymbolSql()
3891+
// For this case aliasGathering flag is added to the context in first iteration and
3892+
// is checked below to prevent looping.
38993893
const aliases = allFilters ?
39003894
allFilters
3901-
.map(v => (v.query ? v.query.allBackAliasMembersExceptSegments() : {}))
3895+
.map(v => (v.query && !v.query.safeEvaluateSymbolContext().aliasGathering ? v.query.allBackAliasMembersExceptSegments() : {}))
39023896
.reduce((a, b) => ({ ...a, ...b }), {})
39033897
: {};
39043898
// Filtering aliases that somehow relate to this group member

0 commit comments

Comments
 (0)