Skip to content
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

Join path in preaggregations #9212

Open
thePermission opened this issue Feb 11, 2025 · 1 comment
Open

Join path in preaggregations #9212

thePermission opened this issue Feb 11, 2025 · 1 comment
Labels
enhancement New feature proposal pre-aggregations Issues related to pre-aggregations

Comments

@thePermission
Copy link

thePermission commented Feb 11, 2025

Is your feature request related to a problem? Please describe.
I have a datamodel where i can have a cube A, cube B and cube C. Cube A can join to cube B, cube B can join to cube C and cube A can also join to cube C. There is currently no way to define a preaggregation that joins cube A over cube B to cube C instead of directly joining cube A to cube C, except of extending cube A, cube B and cube C and only define the wanted join path. That leads to many exentions of cubes.

Describe the solution you'd like
I want to be able to define a join path in a preaggregation like the following example. (A pre_aggregation doesnt even need to be part of a cube, does it?)

cubes:
  - name: cubeA
    sql_table: cubeA
  
    joins:
      - name: cubeB
        relationship: many_to_one
        sql: "{CUBE.cubeB_id} = {cubeB.id}"
      - name: cubeC
        relationship: many_to_one
        sql: "{CUBE.cubeC_id} = {cubeC.id}"

  - name: cubeB
    sql_table: cubeB
  
    joins:
      - name: cubeC
        relationship: many_to_one
        sql: "{CUBE.cubeC_id} = {cubeC.id}"

pre_aggregations:
  - name: cubeAandC
      cubes:
      - join_path: cubeA
        dimensions:
          - dimension1
        measures:
          - measure1
      - join_path: cubeA.cubeB.cubeC
        dimensions:
          - dimension2
        measures:
          - measure2

Or i want to use a view and configure it to be preaggregated. Thats beeing said, its probably not possible or pretty hard to reuse this pre_aggregation for multiple views, but it would probably still find its usecases and makes it easy to figure out if a pre_aggregation can be used to a query for this view. Example:

views:
  - name: CubeA_and_CubeC_View
 
    cubes:
      - join_path: cubeA
        includes:
        - dimension1
        - measure1
      - join_path: cubeA.cubeB.cubeC
        includes:
          - dimension2
          - measure2

    preAggregation:
      - name: cubeA_and_cubeC_preagg
        includes: "*"
        time_dimension: cubeA.dimension1
        granularity: day

Describe alternatives you've considered
Extending cube A and only define a join to cube C directly

@igorlukanin igorlukanin added enhancement New feature proposal pre-aggregations Issues related to pre-aggregations labels Feb 13, 2025
@igorlukanin
Copy link
Member

I think this is a great proposal and I feel like the first solution (with join_paths that are similar to the ones in views) is the way forward.

A pre_aggregation doesnt even need to be part of a cube, does it?

It has to be currently, but I definitely see them being moved somewhere else, i.e., separate files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature proposal pre-aggregations Issues related to pre-aggregations
Projects
None yet
Development

No branches or pull requests

2 participants