Skip to content

Querying measures in rollup joins #10441

@areebbeigh-qai

Description

@areebbeigh-qai

Problem

I have two cubes from different datasources (cube1, cube2) with a many-to-one join from cube2 to cube1. I'm able to make join queries as long as I only include the dimensions from the rollup join but when I include a measure from cube cube2 the query fails with To join across data sources use rollupJoin with Cube Store. If rollupJoin is defined, this error indicates it doesn't match the query. Please use Rollup Designer to verify it's definition. Found data sources: datasource1, default.

Note that for cube2 I confirmed from the cube playground UI that the measure is picked up during pre-aggregation from Query was accelerated with pre-aggregation in the UI.

My question is whether measures are expected to work in rollup_joins and if so what am I missing?

My cubejs version is cube:1.2.29.

Related Cube.js schema

cube(`cube1`, {
    sql_table: `"DB1"."TABLE1"`,

    data_source: `datasource1`,

    measures: {
        quartic_entry: {
            sql: `QUARTIC_ENTRY`,
            type: `max`,
            title: `Quartic Entry Average`,
        },
        replicate_count: {
            sql: `REPLICATE_COUNT`,
            type: `sum`,
            title: `Replicate Count`
        }
    },

    dimensions: { ... },
    pre_aggregations: {
        t1Rollup: {
            type: `rollup`,
            dimensions: [...],
            measures: [QUARTIC_ENTRY, REPLICATE_COUNT]
         },
         indexes: {...}
    }
}
cube(`cube2`, {
  sql: `SELECT * FROM table2`,
  data_source: `default`,
  joins: {
    cube1: {
      relationship: `many_to_one`,
      sql: `${batchNumber} =  ${cube1.x_comet_batch}`
    }
  },
  dimensions: {...},
  pre_aggregations: {
    t2Rollup: {
      type: `rollup`,
      dimensions: [...],
      indexes: [...]
    },
    combinedRollup: {
       type: 'rollup_join',
       dimensions: [...],
       measures: [cube1.quartic_entry, cube1.replicate_count], // Can't query these
       rollups: [cube1. cube2],
    }
  }

Related Cube.js generated SQL

NA

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionThe issue is a question. Please use Stack Overflow for questions.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions