Skip to content

Commit ca33fe4

Browse files
committed
fix: TypeError: Cannot read property 'map' of undefined\n at /cube/node_modules/@cubejs-backend/server-core/src/core/RefreshScheduler.ts:349:86\n
1 parent 00a239f commit ca33fe4

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

packages/cubejs-server-core/src/core/RefreshScheduler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ export class RefreshScheduler {
346346
queriesCache[key] = this.refreshQueriesForPreAggregation(
347347
context, compilerApi, preAggregation, { ...queryingOptions, timezone }
348348
).then(
349-
({ groupedPartitions }) => groupedPartitions[groupedPartitions.length - 1].map(partition => {
349+
({ groupedPartitions }) => (groupedPartitions[groupedPartitions.length - 1] || []).map(partition => {
350350
let cascadedPartitions: PreAggregationDescription[] = [];
351351
for (let j = 0; j < groupedPartitions.length - 1; j++) {
352352
cascadedPartitions = cascadedPartitions.concat(groupedPartitions[j]);

packages/cubejs-server-core/test/unit/RefreshScheduler.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,19 @@ cube('Foo', {
4444
incremental: true
4545
}
4646
},
47+
orphaned: {
48+
type: 'rollup',
49+
measureReferences: [count],
50+
timeDimensionReference: time,
51+
granularity: 'day',
52+
partitionGranularity: 'day',
53+
scheduledRefresh: true,
54+
refreshKey: {
55+
every: '1 hour',
56+
updateWindow: '1 day',
57+
incremental: true
58+
}
59+
},
4760
second: {
4861
type: 'rollup',
4962
measureReferences: [total],

0 commit comments

Comments
 (0)