Skip to content

Commit

Permalink
fix(schema-compiler): Convert timezone for time dimensions in measures
Browse files Browse the repository at this point in the history
  • Loading branch information
MazterQyou committed May 8, 2024
1 parent 990a767 commit 0bea221
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/cubejs-schema-compiler/src/adapter/BaseMeasure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,22 @@ export class BaseMeasure {

public measureSql() {
if (this.expression) {
return this.query.evaluateSymbolSql(this.expressionCubeName, this.expressionName, this.definition(), 'measure');
return this.convertTzForRawTimeDimensionIfNeeded(() => this.query.evaluateSymbolSql(this.expressionCubeName, this.expressionName, this.definition(), 'measure'));
}
return this.query.measureSql(this);
}

// We need this for measures however we don't for filters for performance reasons
public convertTzForRawTimeDimensionIfNeeded(sql) {
if (this.query.options.convertTzForRawTimeDimension) {
return this.query.evaluateSymbolSqlWithContext(sql, {
convertTzForRawTimeDimension: true
});
} else {
return sql();
}
}

public cube() {
if (this.expression) {
return this.query.cubeEvaluator.cubeFromPath(this.expressionCubeName);
Expand Down

0 comments on commit 0bea221

Please sign in to comment.