Skip to content

Commit

Permalink
[WIP add test] fix(schema-compiler): Handle member expressions in key…
Browse files Browse the repository at this point in the history
…Dimensions

 If dimension is member expression, `d.dimension` would be object, and key would be '[object Object]' string, so separate dimensions would have same key, and all but one will be eliminated
  • Loading branch information
mcheshkov committed Jan 8, 2025
1 parent ee826e1 commit d2210a2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/cubejs-schema-compiler/src/adapter/BaseQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -1855,7 +1855,14 @@ export class BaseQuery {
keyDimensions(primaryKeyDimensions) {
// The same dimension with different granularities maybe requested, so it's not enough to filter only by dimension
return R.uniqBy(
(d) => `${d.dimension}${d.granularity ?? ''}`, this.dimensionsForSelect()
(d) => {
if (d.isMemberExpression) {
return d.dimension.definition;
}

return `${d.dimension}${d.granularity ?? ''}`;
},
this.dimensionsForSelect()
.concat(primaryKeyDimensions)
);
}
Expand Down

0 comments on commit d2210a2

Please sign in to comment.