cube-js / cube-js/cube

Querying measures in rollup joins

Open
#10,441 3 comments 1 reaction 0 assignees View on GitHub
question
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

**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**
```javascript
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: {...}
}
}
```

```javascript
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.