Skip to content

Commit 20733cf

Browse files
committed
fix(schema-compiler): Fix ungrouped cumulative queries incorrect sql generation
1 parent 1739929 commit 20733cf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2539,6 +2539,10 @@ export class BaseQuery {
25392539
return evaluateSql === '*' ? '1' : evaluateSql;
25402540
}
25412541
if (this.ungrouped) {
2542+
if ((this.safeEvaluateSymbolContext().ungroupedAliasesForCumulative || {})[measurePath]) {
2543+
evaluateSql = this.safeEvaluateSymbolContext().ungroupedAliasesForCumulative[measurePath];
2544+
}
2545+
25422546
if (symbol.type === 'count' || symbol.type === 'countDistinct' || symbol.type === 'countDistinctApprox') {
25432547
const sql = this.caseWhenStatement([{ sql: `(${evaluateSql}) IS NOT NULL`, label: '1' }]);
25442548
return evaluateSql === '*' ? '1' : sql;

0 commit comments

Comments
 (0)