Skip to content

Commit 1c667fe

Browse files
committed
refresh only matched partitions fix
1 parent 530096a commit 1c667fe

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

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

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -688,10 +688,39 @@ export class RefreshScheduler {
688688
if (queryingOptions.dateRange) {
689689
preAggregations.forEach(preAggregation => {
690690
preAggregation.partitions = preAggregation.partitions
691-
.filter(p => PreAggregationPartitionRangeLoader.intersectDateRanges(
692-
[p.buildRangeStart, p.buildRangeEnd],
693-
queryingOptions.dateRange,
694-
));
691+
.filter(p => {
692+
if (!p.buildRangeStart && !p.buildRangeEnd) {
693+
return true; // If there is no range specified - we should include it like rebuild in anyway
694+
}
695+
696+
return PreAggregationPartitionRangeLoader.intersectDateRanges(
697+
[p.buildRangeStart, p.buildRangeEnd],
698+
queryingOptions.dateRange,
699+
);
700+
});
701+
preAggregation.partitionsWithDependencies.forEach(pd => {
702+
pd.partitions = pd.partitions.filter(p => {
703+
if (!p.buildRangeStart && !p.buildRangeEnd) {
704+
return true; // If there is no range specified - we should include it like rebuild in any way
705+
}
706+
707+
return PreAggregationPartitionRangeLoader.intersectDateRanges(
708+
[p.buildRangeStart, p.buildRangeEnd],
709+
queryingOptions.dateRange,
710+
);
711+
});
712+
713+
pd.dependencies = pd.dependencies.filter(p => {
714+
if (!p.buildRangeStart && !p.buildRangeEnd) {
715+
return true; // If there is no range specified - we should include it like rebuild in any way
716+
}
717+
718+
return PreAggregationPartitionRangeLoader.intersectDateRanges(
719+
[p.buildRangeStart, p.buildRangeEnd],
720+
queryingOptions.dateRange,
721+
);
722+
});
723+
});
695724
});
696725
}
697726

0 commit comments

Comments
 (0)