Skip to content

Commit

Permalink
fix: Unrecognized name when regular measures are selected with multip…
Browse files Browse the repository at this point in the history
…lied ones

Fixes #8206
  • Loading branch information
paveltiunov committed May 3, 2024
1 parent 300c923 commit 617fd11
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/cubejs-schema-compiler/src/adapter/BaseQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -2352,7 +2352,7 @@ export class BaseQuery {
}

renderSqlMeasure(name, evaluateSql, symbol, cubeName, parentMeasure, orderBySql) {
const multiplied = this.multipliedJoinRowResult(cubeName);
const multiplied = this.multipliedJoinRowResult(cubeName) || false;
const measurePath = `${cubeName}.${name}`;
let resultMultiplied = multiplied;
if (multiplied && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,11 @@ describe('SQL Generation', () => {
type: 'count'
},
id_sum: {
sql: 'id',
type: 'sum'
},
visitorCheckinsRolling: {
type: 'count',
rollingWindow: {
Expand Down Expand Up @@ -386,6 +391,16 @@ describe('SQL Generation', () => {
granularity: 'day'
}
}
});
view('visitors_visitors_checkins_view', {
cubes: [{
join_path: 'visitors',
includes: ['revenue', 'source', 'updated_at', 'visitor_revenue']
}, {
join_path: 'visitors.visitor_checkins',
includes: ['visitor_checkins_count', 'id_sum']
}]
})
cube('visitor_checkins_sources', {
Expand Down Expand Up @@ -2679,6 +2694,26 @@ describe('SQL Generation', () => {
}]
));

it('multiplied sum and count no dimensions through view', async () => runQueryTest(
{
measures: ['visitors_visitors_checkins_view.revenue', 'visitors_visitors_checkins_view.visitor_checkins_count'],
},
[{
visitors_visitors_checkins_view__revenue: '2000',
visitors_visitors_checkins_view__visitor_checkins_count: '6'
}]
));

it('multiplied sum no dimensions through view', async () => runQueryTest(
{
measures: ['visitors_visitors_checkins_view.revenue', 'visitors_visitors_checkins_view.id_sum'],
},
[{
visitors_visitors_checkins_view__revenue: '2000',
visitors_visitors_checkins_view__id_sum: '21'
}]
));

// TODO not implemented
// it('post aggregate bucketing', async () => runQueryTest(
// {
Expand Down

0 comments on commit 617fd11

Please sign in to comment.