Skip to content

Commit 7891b6c

Browse files
authored
fix: Do not update structure version on build range end update (#6015)
1 parent 18097a7 commit 7891b6c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

packages/cubejs-query-orchestrator/src/orchestrator/PreAggregations.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export function getLastUpdatedAtTimestamp(
9090
}
9191

9292
function getStructureVersion(preAggregation) {
93-
const versionArray = [preAggregation.loadSql];
93+
const versionArray = [preAggregation.structureVersionLoadSql || preAggregation.loadSql];
9494
if (preAggregation.indexesSql && preAggregation.indexesSql.length) {
9595
versionArray.push(preAggregation.indexesSql);
9696
}
@@ -179,6 +179,7 @@ export type PreAggregationDescription = {
179179
timezone: string;
180180
indexesSql: IndexDescription[];
181181
invalidateKeyQueries: QueryWithParams[];
182+
structureVersionLoadSql: QueryWithParams;
182183
sql: QueryWithParams;
183184
loadSql: QueryWithParams;
184185
tableName: string;
@@ -1575,6 +1576,8 @@ export class PreAggregationPartitionRangeLoader {
15751576
return {
15761577
...this.preAggregation,
15771578
tableName: partitionTableName,
1579+
structureVersionLoadSql: this.preAggregation.loadSql &&
1580+
this.replacePartitionSqlAndParams(this.preAggregation.loadSql, range, partitionTableName),
15781581
loadSql: this.preAggregation.loadSql &&
15791582
this.replacePartitionSqlAndParams(this.preAggregation.loadSql, loadRange, partitionTableName),
15801583
sql: this.preAggregation.sql &&

packages/cubejs-query-orchestrator/test/unit/QueryOrchestrator.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,6 +1214,7 @@ describe('QueryOrchestrator', () => {
12141214
expect(result.data[0]).toMatch(/orders_d20210501/);
12151215
expect(result.data[0]).not.toMatch(/orders_h2021053000/);
12161216
expect(result.data[0]).toMatch(/orders_h2021053100/);
1217+
expect(result.data[0]).toMatch(/orders_h2021060100_2i3ibaj2_d004iq51/);
12171218

12181219
result = await queryOrchestrator.fetchQuery(query(['2021-05-31T00:00:00.000', '2021-05-31T23:59:59.999']));
12191220
console.log(JSON.stringify(result, null, 2));

0 commit comments

Comments
 (0)