-
Notifications
You must be signed in to change notification settings - Fork 2.1k
docs: show the multi-fact AOV measure owned by a cube, not only by a view #11659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
paveltiunov
merged 6 commits into
master
from
claude/multi-fact-derived-metric-test-j4uypn
Aug 27, 2026
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
de0f558
docs: show the AOV measure owned by a cube, not only by a view
claude d7cdd94
test(testing): cover the multi-fact AOV ratio end to end
claude 77cc60b
test: pin the view-without-the-other-fact claim; make both filters bite
claude 560c90c
test(testing): read the planner flag the way the server does; review …
claude 29bcb70
test(cubejs-testing): run the multi-fact smoke suite on both CI legs
claude a7f1969
test(schema-compiler): correct stale module header on the AOV spec
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/cubejs-testing/birdbox-fixtures/multi-fact/schema/ItemLocationSales.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // Sales dollars, pre-aggregated to day/item/location in the warehouse. The | ||
| // numerator of AOV. West totals 100, East totals 60. | ||
| cube(`ItemLocationSales`, { | ||
| sql: ` | ||
| select 1 as id, 1 as location_id, 30 as sales_amount | ||
| UNION ALL | ||
| select 2 as id, 1 as location_id, 70 as sales_amount | ||
| UNION ALL | ||
| select 3 as id, 2 as location_id, 60 as sales_amount | ||
| `, | ||
|
|
||
| joins: { | ||
| Locations: { | ||
| sql: `${CUBE}.location_id = ${Locations}.id`, | ||
| relationship: `many_to_one`, | ||
| }, | ||
| }, | ||
|
|
||
| dimensions: { | ||
| id: { | ||
| sql: `id`, | ||
| type: `number`, | ||
| primaryKey: true, | ||
| }, | ||
| }, | ||
|
|
||
| measures: { | ||
| salesAmount: { | ||
| sql: `sales_amount`, | ||
| type: `sum`, | ||
| }, | ||
| }, | ||
| }); |
21 changes: 21 additions & 0 deletions
21
packages/cubejs-testing/birdbox-fixtures/multi-fact/schema/Locations.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // Shared dimension cube. Both facts join to it, which is what gives a | ||
| // multi-fact query something to stitch the two aggregates on. | ||
| cube(`Locations`, { | ||
| sql: ` | ||
| select 1 as id, 'West' as region | ||
| UNION ALL | ||
| select 2 as id, 'East' as region | ||
| `, | ||
|
|
||
| dimensions: { | ||
| id: { | ||
| sql: `id`, | ||
| type: `number`, | ||
| primaryKey: true, | ||
| }, | ||
| region: { | ||
| sql: `region`, | ||
| type: `string`, | ||
| }, | ||
| }, | ||
| }); |
26 changes: 26 additions & 0 deletions
26
packages/cubejs-testing/birdbox-fixtures/multi-fact/schema/RetailAnalysis.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| // The same ratio owned by the view instead, alongside the cube-owned one, so | ||
| // both placements are exercised against a real database. | ||
| view(`RetailAnalysis`, { | ||
| cubes: [ | ||
| { | ||
| joinPath: ItemLocationSales, | ||
| includes: [`salesAmount`], | ||
| }, | ||
| { | ||
| joinPath: SalesLineItem, | ||
| includes: [`transactionsWithoutReturns`, { name: `aovBasket`, alias: `aovBasketFromCube` }], | ||
| }, | ||
| { | ||
| joinPath: Locations, | ||
| includes: [`region`], | ||
| }, | ||
| ], | ||
|
|
||
| measures: { | ||
| aovBasket: { | ||
| sql: `${CUBE.salesAmount} / NULLIF(${CUBE.transactionsWithoutReturns}, 0)`, | ||
| type: `number`, | ||
| multiStage: true, | ||
| }, | ||
| }, | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.