Skip to content

Commit

Permalink
Revert: deep evaluateSymbolSql processing
Browse files Browse the repository at this point in the history
  • Loading branch information
KSDaemon committed Aug 20, 2024
1 parent 0b69115 commit 63156b8
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions packages/cubejs-schema-compiler/src/adapter/BaseQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -2135,10 +2135,6 @@ export class BaseQuery {
return this.evaluateSymbolSql(dimension.path()[0], dimension.path()[1], dimension.dimensionDefinition());
}

dimensionGranularitySql(dimension) {
return this.evaluateSymbolSql(dimension.path()[0], dimension.path()[1], dimension.dimensionDefinition(), null, ['granularities', dimension.granularity]);
}

segmentSql(segment) {
return this.evaluateSymbolSql(segment.path()[0], segment.path()[1], segment.segmentDefinition());
}
Expand Down Expand Up @@ -2195,12 +2191,12 @@ export class BaseQuery {
return this.evaluateSymbolContext || {};
}

evaluateSymbolSql(cubeName, name, symbol, memberExpressionType, childPropPathArray) {
evaluateSymbolSql(cubeName, name, symbol, memberExpressionType) {
const isMemberExpr = !!memberExpressionType;
if (!memberExpressionType) {
this.pushMemberNameForCollectionIfNecessary(cubeName, name);
}
const memberPathArray = [cubeName, name].concat(childPropPathArray ?? []);
const memberPathArray = [cubeName, name];
const memberPath = this.cubeEvaluator.pathFromArray(memberPathArray);
let type = memberExpressionType;
if (!type && this.cubeEvaluator.isMeasure(memberPathArray)) {
Expand Down Expand Up @@ -2305,17 +2301,7 @@ export class BaseQuery {
this.autoPrefixAndEvaluateSql(cubeName, symbol.longitude.sql, isMemberExpr)
]);
} else {
let res;

// TODO Temporarily placed it here, but maybe this should be moved level up and processed in
// more generalized way to support nested properties not only on dimension level
if (childPropPathArray && childPropPathArray.length > 0) {
const childProperty = this.cubeEvaluator.byPath('dimensions', memberPathArray);
res = this.autoPrefixAndEvaluateSql(cubeName, childProperty.sql, isMemberExpr);
} else {
res = this.autoPrefixAndEvaluateSql(cubeName, symbol.sql, isMemberExpr);
}

let res = this.autoPrefixAndEvaluateSql(cubeName, symbol.sql, isMemberExpr);
if (symbol.shiftInterval) {
res = `(${this.addTimestampInterval(res, symbol.shiftInterval)})`;
}
Expand Down

0 comments on commit 63156b8

Please sign in to comment.