Skip to content

Commit 0f88537

Browse files
committed
feat(schema-compiler): Support joins for proxied time dimensions in pre-aggregations
1 parent f556b62 commit 0f88537

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4009,7 +4009,17 @@ export class BaseQuery {
40094009
const dimensionSql = this.dimensionSql(dimension);
40104010
return `select ${aggFunction}(${this.convertTz(dimensionSql)}) from ${this.cubeSql(cube)} ${this.asSyntaxTable} ${this.cubeAlias(cube)}`;
40114011
}
4012-
return null;
4012+
4013+
// Handle case that requires joins
4014+
const subQuery = this.newSubQuery({
4015+
dimensions: [dimension.dimension],
4016+
rowLimit: null,
4017+
});
4018+
4019+
const dimensionSql = subQuery.dimensionSql(dimension);
4020+
const fromClause = subQuery.query();
4021+
4022+
return `select ${aggFunction}(${subQuery.convertTz(dimensionSql)}) from ${fromClause}`;
40134023
}
40144024

40154025
cubeCardinalityQueries() { // TODO collect sub queries

0 commit comments

Comments
 (0)