cube-js / cube-js/cube

rollupJoin measures are not considered when they are a SQL expression

Open
#3,029 0 comments 0 reactions 1 assignee Assigned to @hassankhan View on GitHub
docs pre-aggregations
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

**To Reproduce**
Using a measure like this in a rollupJoin does not work:
```
billmin: {
sql: `${CUBE.billsec}/60`,
type: `number`
},
```

**Expected behavior**
When the measure is an expression, but adheres to all requirements to be in a pre-aggregation query, like being addictive, it is expected that it will work like other measures that are not an expression.

**Version:**
0.27.42

**Additional context**
Seems that the code explicitly ignores expression measures from the computation. This is just one of the places that have that logic.

https://github.com/cube-js/cube.js/blob/d83717406363c7fcf755b7a7a23e2055c4929188/packages/cubejs-schema-compiler/src/adapter/BaseMeasure.js#L80

Also, the error message returned in that case, is really generic like below. Another improvement would be to have better error messages to clarify the reason it does not find the measures.
`Error: To join across data sources use rollupJoin with external pre-aggregations. Found data sources: voice, application`

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.