Joins are not inherited (when` extends` is used)
Describe the bug From the docs:
The usual pattern is to extract common measures, dimensions, and joins into the base cube and then extend from the base cube
However, joins are not indeed inherited.
To Reproduce Steps to reproduce the behavior:
- Use this data model:
cubes:
- name: cube_joined
sql: SELECT 123 AS id, 456 AS value
dimensions:
- name: id
sql: id
type: number
primary_key: true
- name: value
sql: value
type: number
- name: cube_parent
sql: SELECT 1 AS id, 123 AS joined_id, 789 AS value
joins:
- name: cube_joined
relationship: one_to_one
sql: "{CUBE.joined_id} = {cube_joined.id}"
dimensions:
- name: id
sql: id
type: number
primary_key: true
- name: joined_id
sql: joined_id
type: number
- name: value
sql: value
type: number
- name: cube_child
extends: cube_parent
- Run the following query—it will work:
{
"dimensions": [
"cube_parent.value",
"cube_joined.value"
]
}
- Then, run the following query—it will fail:
{
"dimensions": [
"cube_child.value",
"cube_joined.value"
]
}
Error:
Expected behavior
Last query should succeed since cube_child should inherit everything from cube_parent.
Version: 0.33.52
I'm running into a similar issue, although with slightly different results. I'm defining my Cubes with js instead of yaml, and if a joins collection isn't defined then the joins are inherited as expected. However, if the child cube has an empty joins section or defines additional joins then the parent joins aren't available.
With the following data model:
I am able to run the following query:
However, if I add a join in the OnlineOrder Cube like this:
or add an empty joins collection like this:
When I run the same query as above, I get a similar error as igorlukanin
Can't find join path to join 'OnlineOrder', 'Customer'
I've worked with Cube support on the issue, and at the moment their solution was to just include the joins in the cube you need to use them with if you have additional joins, so in this example I would have to copy the Customer join to the OnlineOrder Cube.
Version: 0.34.0
Was this fixed in #7433? (released in 0.34.23)
EDIT: looks like a different issue was fixed in #7433 – pre-aggs, not joins
Just to add, defining the parent cube in js and the child in yaml also fails to inherit joins, even if the child yaml cube does not define any additional joins.