cube-js / cube-js/cube

Query time partitioning preAggregations need time dimensions.

Open
#1,116 4 comments 0 reactions 0 assignees View on GitHub
backend:server
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.**

I use big query for data Warehouse and PostgreSQL for the external preAggregations database.
When I query without time dimensions, it doesn't query to preAggregations in PostgreSQL , it accesses to bigquery. But I want query all-time. I see in document
> Partitioned rollups currently cannot be used by queries without time dimensions.

So I understand Partitioned rollups only support without time dimensions. Do you have a plan for this?
Thank you very much,

**this is my schema**
```
const schemas = require('../utils/constant').schemas;
const getContextField = require('../utils/helper').getContextField;

asyncModule(async () => {
for (const schema of schemas) {
const identifiesContextFields = await getContextField(schema, 'identifies');
cube(`${schema}_Users`, {
sql: `select
_user_id as user_id,
_PARTITIONTIME as partition_time,
name,
email,
plan,
original_timestamp as original_timestamp,
${identifiesContextFields.toString()}
from ${schema}.identifies
where ${FILTER_PARAMS[`${schema}_Users`].partition_time.filter('_PARTITIONTIME')}`,
measures: {
count: {
sql: `user_id`,
type: `countDistinct`
},
max: {
sql: `original_timestamp`,
type: `max`
}
},
sqlAlias: `${schema}_u`,
dimensions: {
userId: {
sql: `user_id`,
type: `string`,
primaryKey: true,
shown: true
},
name: {
sql: `name`,
type: `string`,
},
email: {
sql: `email`,
type: `string`,
},
plan: {
sql: `plan`,
type: `string`,
},
partitionTime: {
sql: `partition_time`,
type: `time`
},
...identifiesContextFields.map(identify => ({
[identify]: {
sql: `${identify}`,
type: `string`
}
})).reduce((a,b) => ({...a, ...b}))
}
,

preAggregations: {
main: {
type: `rollup`,
dimensionReferences: [`${schema}_Users.userId`, `${schema}_Users.name`, `${schema}_Users.email`, `${schema}_Users.plan`, `${schema}_Users.partitionTime`],
measureReferences: [`${schema}_Users.max`],
timeDimensionReference: `${schema}_Users.partitionTime`,
granularity: `day`,
partitionGranularity: `day`,
refreshKey: {
every: `10 second`,
incremental: true,
updateWindow: `1 day`,
},
scheduledRefresh: true,
external: true
}
}
})
}
}
)
```

**Additional context**
Cubejs v0.20.3

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.