cube-js / cube-js/cube

Mixed offset rolling window pre-aggregations

Open
#7,084 0 comments 0 reactions 0 assignees View on GitHub
data modeling pre-aggregations
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

**Is your feature request related to a problem? Please describe.**
We have a pre-aggregation on an additive measure that is based on two other rolling window measures. One of these has a rolling window offset of `start`, the other of `end`.
This throws the following error when queried: '_Mixed offset rolling window querying is not supported_'
This prevents us from implementing pre-aggregations on some of our heaviest queries.

**Describe the solution you'd like**
Support pre-aggregations with mixed offset types. I can see that there is already a plan to introduce a virtual `both` offset.
https://github.com/cube-js/cube/blob/54bdfeec01ce9bbdd78b022fcf02687a9dcf0793/packages/cubejs-schema-compiler/src/adapter/CubeStoreQuery.ts#L209

**Additional context**
Data model:
```yaml
measures:
- name: rolling_window_measure_with_offset_start
public: false
type: sum
sql: "column_a"
rolling_window:
trailing: unbounded
offset: start
- name: rolling_window_measure_with_offset_end
public: false
type: sum
sql: "column_b"
rolling_window:
trailing: unbounded
offset: end
pre_aggregations:
- name: main
measures:
- rolling_window_measure_with_offset_start
- rolling_window_measure_with_offset_end
time_dimension: time
granularity: month

```

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.