-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
questionThe issue is a question. Please use Stack Overflow for questions.The issue is a question. Please use Stack Overflow for questions.
Description
Describe the bug
I want to partition my activity data month-wise. However, cubejs is combining data of more than 1 months in this manner:
Oct 2024 -> From 1 Oct 2024 to 17 Dec 2024.
Nov 2024 -> From 1 Oct 2024 to 17 Dec 2024.
Dec 2024 -> From 1 Oct 2024 to 17 Dec 2024
Expected behavior
It should store only one month data in one partition:
Oct 2024 -> From 1 Oct 2024 to 31 Oct 2024.
Nov 2024 -> From 1 Nov 2024 to 30 Nov 2024.
Dec 2024 -> From 1 Dec 2024 to 17 Dec 2024
cube(`Activity`, {
sql: `SELECT id, user_id, type, activity_time, remarks, modified_date FROM public.activity where company = ${COMPILE_CONTEXT.securityContext.companyId} and ${FILTER_PARAMS.Activity.activityTime.filter('activity_time')}
`,
pre_aggregations: {
main: {
type: `original_sql`,
external: false,
time_dimension: CUBE.activityTime,
partition_granularity: `month`,
allow_non_strict_date_range_match: true,
refresh_key: {
every: `1 hour`,
sql: `SELECT MAX(t.modified_date) FROM public.activity where company = ${COMPILE_CONTEXT.securityContext.companyId} and ${FILTER_PARAMS.Activity.activityTime.filter('activity_time')}`,
},
build_range_start: {
sql: `SELECT date_trunc('month', NOW()) - interval '2 year'`
},
build_range_end: {
sql: `SELECT date_trunc('month', NOW()) + interval '1 month'`
}
}
},
measures: {
count: {
type: `count`
}
},
dimensions: {
id: {
sql: `id`,
type: `number`,
primaryKey: true
},
type: {
sql: `type`,
type: `string`
},
remarks: {
sql: `remarks`,
type: `string`
},
activityTime: {
sql: `activity_time`,
type: `time`
}
}
});Request:
{"query":{
"limit":10,
"offset":0,
"order":{},
"timeDimensions":[{"dimension":"Activity.activityTime","granularity":"day","dateRange":"This Quarter"}],
"dimensions":["Activity.id"],
"measures":["Activity.count"],
"filters":[],
"renewQuery":false
},"queryType":"multi"}Result:
Activity ID Count
100 3
101 3
102 3
Version:
1.0.0 to 1.0.7
Metadata
Metadata
Assignees
Labels
questionThe issue is a question. Please use Stack Overflow for questions.The issue is a question. Please use Stack Overflow for questions.