Skip to content

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

@igorlukanin

Description

@igorlukanin

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

Metadata

Metadata

Assignees

Labels

bugLEGACY. Use the Bug issue type insteaddata modeling

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions