Skip to content

Joins are not inherited (when extends is used) #7137

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

Closed
igorlukanin opened this issue Sep 15, 2023 · 5 comments
Closed

Joins are not inherited (when extends is used) #7137

igorlukanin opened this issue Sep 15, 2023 · 5 comments
Assignees
Labels
bug Something isn't working data modeling

Comments

@igorlukanin
Copy link
Member

igorlukanin commented Sep 15, 2023

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:

  1. 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
  1. Run the following query—it will work:
{
  "dimensions": [
    "cube_parent.value",
    "cube_joined.value"
  ]
}
  1. Then, run the following query—it will fail:
{
  "dimensions": [
    "cube_child.value",
    "cube_joined.value"
  ]
}

Error:
Screenshot 2023-09-15 at 14 33 44

Expected behavior
Last query should succeed since cube_child should inherit everything from cube_parent.

Version:
0.33.52

@Bmarquez1997
Copy link

Bmarquez1997 commented Nov 21, 2023

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:
image

I am able to run the following query:
image

However, if I add a join in the OnlineOrder Cube like this:
image
or add an empty joins collection like this:
image

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

@adamfeldman
Copy link

adamfeldman commented Nov 28, 2023

Was this fixed in #7433? (released in 0.34.23)

EDIT: looks like a different issue was fixed in #7433 – pre-aggs, not joins

@CaseCal
Copy link

CaseCal commented Mar 28, 2024

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.

@igorlukanin
Copy link
Member Author

Still the issue for Cube v0.36.7.

@igorlukanin igorlukanin changed the title Joins are not inherited (when extends is used) Joins are not inherited (when extends is used) Nov 6, 2024
@KSDaemon
Copy link
Member

Closed via #9386

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working data modeling
Projects
None yet
Development

No branches or pull requests

6 participants