cube(`orders`, {
sql: `
SELECT 1 AS a, 'X1' AS b, 'Y1' AS c, 'Z1' AS d, 'W1' AS e, NOW()::Date AS f
UNION ALL
SELECT 2, 'X1', 'Y2', 'Z2', 'W2', NOW()::Date
UNION ALL
SELECT 3, 'X2', 'Y1', 'Z1', 'W1', NOW()::Date
`,
joins: {
t1: {
sql: `${CUBE.b} = ${t1.b}`,
relationship: `many_to_one`,
},
t2: {
sql: `${CUBE.c} = ${t2.c}`,
relationship: `many_to_one`,
},
t3: {
sql: `${CUBE.d} = ${t3.d}`,
relationship: `many_to_one`,
},
t4: {
sql: `${CUBE.e} = ${t4.e}`,
relationship: `many_to_one`,
},
},
dimensions: {
a: { sql: `a`, type: `number`, primary_key: true },
b: { sql: `b`, type: `string` },
c: { sql: `c`, type: `string` },
d: { sql: `d`, type: `string` },
e: { sql: `e`, type: `string` },
f: { sql: `f`, type: `time` },
g: { sql: `${t1.g}`, type: `string` },
h: { sql: `${t3.h}`, type: `string` },
},
measures: {
count: { type: `count` },
},
pre_aggregations: {
main_rollup: {
type: `rollup`,
time_dimension: CUBE.f,
granularity: `day`,
partition_granularity: `month`,
dimensions: [CUBE.a, CUBE.b, CUBE.c, CUBE.d, CUBE.e, CUBE.f],
measures: [CUBE.count],
refresh_key: { every: `1 day` },
indexes: {
b_index: { columns: [CUBE.b] },
c_index: { columns: [CUBE.c] },
d_index: { columns: [CUBE.d] },
e_index: { columns: [CUBE.e] },
},
},
combined_rollup: {
type: `rollup_join`,
time_dimension: CUBE.f,
granularity: `day`,
partition_granularity: `day`,
dimensions: [
CUBE.f,
t1.g,
t2.c,
t3.h,
t4.e,
],
measures: [CUBE.count],
rollups: [
CUBE.main_rollup,
t1.t1_rollup,
t2.t2_rollup,
t3.t3_rollup,
t4.t4_rollup,
],
},
},
});
cube(`t1`, {
sql: `
SELECT 'X1' AS b, 'S1' AS g
UNION ALL
SELECT 'X2', 'S2'
`,
dimensions: {
b: { sql: `b`, type: `string`, primary_key: true },
g: { sql: `g`, type: `string` },
},
pre_aggregations: {
t1_rollup: {
type: `rollup`,
dimensions: [CUBE.b, CUBE.g],
refresh_key: { every: `1 day` },
indexes: { b_index: { columns: [CUBE.b] } },
},
},
});
cube(`t2`, {
sql: `
SELECT 'Y1' AS c
UNION ALL
SELECT 'Y2'
`,
dimensions: {
c: { sql: `c`, type: `string`, primary_key: true },
},
pre_aggregations: {
t2_rollup: {
type: `rollup`,
dimensions: [CUBE.c],
refresh_key: { every: `1 day` },
indexes: { c_index: { columns: [CUBE.c] } },
},
},
});
cube(`t3`, {
sql: `
SELECT 'Z1' AS d, 'Alpha' AS h
UNION ALL
SELECT 'Z2', 'Beta'
`,
dimensions: {
d: { sql: `d`, type: `string`, primary_key: true },
h: { sql: `h`, type: `string` },
},
pre_aggregations: {
t3_rollup: {
type: `rollup`,
dimensions: [CUBE.d, CUBE.h],
refresh_key: { every: `1 day` },
indexes: { d_index: { columns: [CUBE.d] } },
},
},
});
cube(`t4`, {
sql: `
SELECT 'W1' AS e
UNION ALL
SELECT 'W2'
`,
dimensions: {
e: { sql: `e`, type: `string`, primary_key: true },
},
pre_aggregations: {
t4_rollup: {
type: `rollup`,
dimensions: [CUBE.e],
refresh_key: { every: `1 day` },
indexes: { e_index: { columns: [CUBE.e] } },
},
},
});
Describe the bug
Starting from version 1.6.28, queries using
rollup_joinpre-aggregations that combine 5 rollups fail with a partition limit error.After checking the code, I believe this is related to the new
distribute_join_partitions()logic (introduced in commit 9da75cd) capsCUBESTORE_MAX_JOINED_PARTITIONSat 5 by default, and arollup_joinreferencing 5 rollups hits this limit exactly.Here is the exact error:
Now I have some questions:
CUBESTORE_MAX_JOINED_PARTITIONSand set it to a higher number? I'm not sure if it's OK because it's not even documented yet.To Reproduce
orders) with 4many_to_onejoins to dimension cubesrollup_joinpre-aggregation that references all 5 rollupscombined_rollupExpected behavior
The query should execute successfully. A
rollup_joinwith 5 constituent rollups should not exceed the default partition limit, as each dimension rollup is a single partition.Minimally reproducible Cube Schema
I tried my best to create something reproducible but not sure if I was successful or not.
Schema
Query to reproduce
Version:
1.6.28+
Additional context
N/A