-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
pre-aggregationsIssues related to pre-aggregationsIssues related to pre-aggregationsquestionThe issue is a question. Please use Stack Overflow for questions.The issue is a question. Please use Stack Overflow for questions.
Description
Problem
version: 1.5.4
We have a pre-aggregation where multiple cubes are referenced in a query. In this query, certain dimensions are used only as filters. What we’ve observed is that when a dimension is used solely as a filter—and not listed in the query’s dimensions—Cube is unable to match a pre-aggregation. It appears that all dimensions defined in the pre-aggregation must also be included in the query dimensions; otherwise, Cube does not consider the pre-aggregation applicable.
We found the following information in the Cube documentation on pre-aggregation matching
Are query filter dimensions included in its own dimensions? Cube checks that all filter dimensions are also included as dimensions in the query.Does this mean that all dimensions used as filters must also be included in the query dimensions?Does every member in the query exist in the pre-aggregation? Cube checks that the pre-aggregation contains all dimensions and measures used in the query.Does this require the query to match the pre-aggregation’s dimensions and measures exactly? If the query uses only a subset of the pre-aggregation’s dimensions, will Cube still be able to use that pre-aggregation?
Related Cube.js schema
cube: performance
...........
...........
...........
# pre-aggregation
- name: report
type: rollup
dimensions:
- order.id
- order.name
- sales.label_value
- sales.label_class
- delivery.ends_at
- delivery.starts_at
- user.name
- user.birth
- user.dob
- user.job
measures:
- performance.count
- performance.total_persons
timeDimension: performance.date
granularity: month
partition_granularity: month
build_range_start:
sql: SELECT DATE_TRUNC('month', CURRENT_DATE) - INTERVAL '1 year'
build_range_end:
sql: SELECT CURRENT_DATE + INTERVAL '1 day'
refresh_key:
every 4 hour
query
{
"measures": [
"performance.count",
"performance.total_persons"
],
"dimensions": [
"order.id",
"order.name",
"sales.label_value",
"sales.label_class",
"delivery.ends_at",
"delivery.starts_at",
"user.name",
"user.birth",
"user.dob",
"user.job"
],
"filters": [
{
"member": "sales.label_class",
"operator": "equals",
"values": [
"basic"
]
},
{
"member": "order.id",
"operator": "equals",
"values": [
"1"
]
}
],
"timeDimensions": [
{
"dimension": "performance.date",
"dateRange": [
"2025-11-01T00:00:00.000",
"2025-11-02T23:59:59.999"
],
"granularity": "month"
}
]
}
darian-heede
Metadata
Metadata
Assignees
Labels
pre-aggregationsIssues related to pre-aggregationsIssues related to pre-aggregationsquestionThe issue is a question. Please use Stack Overflow for questions.The issue is a question. Please use Stack Overflow for questions.