Skip to content

Commit 937aef6

Browse files
committed
fix invalidateKeyQueries not to be in the future
1 parent d11412c commit 937aef6

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ export class PreAggregationPartitionRangeLoader {
161161
return [sql.replace(this.preAggregation.tableName, partitionTableName), params?.map(
162162
param => {
163163
if (dateRange && param === FROM_PARTITION_RANGE) {
164-
return PreAggregationPartitionRangeLoader.inDbTimeZone(this.preAggregation, dateRange[0]);
164+
return dateRange[0];
165165
} else if (dateRange && param === TO_PARTITION_RANGE) {
166-
return PreAggregationPartitionRangeLoader.inDbTimeZone(this.preAggregation, dateRange[1]);
166+
return dateRange[1];
167167
} else {
168168
return param;
169169
}
@@ -193,8 +193,9 @@ export class PreAggregationPartitionRangeLoader {
193193
if ((!partitionInvalidateKeyQueries || partitionInvalidateKeyQueries.length > 0) && buildRangeEnd < range[1]) {
194194
loadRange[1] = buildRangeEnd;
195195
}
196+
// partitionRanges() returns range in UTC.
196197
const sealAt = addSecondsToLocalTimestamp(
197-
loadRange[1], this.preAggregation.timezone, this.preAggregation.updateWindowSeconds || 0
198+
loadRange[1], 'UTC', this.preAggregation.updateWindowSeconds || 0
198199
).toISOString();
199200
return {
200201
...this.preAggregation,

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class MockDriverUnloadWithoutTempTableSupport extends MockDriver {
177177
capabilities() {
178178
return { unloadWithoutTempTable: true };
179179
}
180-
180+
181181
queryColumnTypes() {
182182
return [];
183183
}
@@ -1308,7 +1308,7 @@ describe('QueryOrchestrator', () => {
13081308
expect(result.data[0]).toMatch(/orders_d20210501/);
13091309
expect(result.data[0]).not.toMatch(/orders_h2021053000/);
13101310
expect(result.data[0]).toMatch(/orders_h2021053100/);
1311-
expect(result.data[0]).toMatch(/orders_h2021060100_uozkyaur_d004iq51/);
1311+
expect(result.data[0]).toMatch(/orders_h2021060100_fv2h1pdp_3wsilqun/);
13121312

13131313
result = await queryOrchestrator.fetchQuery(query(['2021-05-31T00:00:00.000', '2021-05-31T23:59:59.999']));
13141314
console.log(JSON.stringify(result, null, 2));
@@ -1319,7 +1319,7 @@ describe('QueryOrchestrator', () => {
13191319
expect(result.data[0]).toMatch(/orders_d20210501/);
13201320
expect(result.data[0]).not.toMatch(/orders_h2021053000/);
13211321
expect(result.data[0]).toMatch(/orders_h2021053100/);
1322-
expect(result.data[0]).toMatch(/orders_h2021060100_uozkyaur_d004iq51/);
1322+
expect(result.data[0]).toMatch(/orders_h2021060100_fv2h1pdp_3wsilqun/);
13231323
});
13241324

13251325
test('lambda partitions week', async () => {
@@ -1407,7 +1407,7 @@ describe('QueryOrchestrator', () => {
14071407
console.log(JSON.stringify(result, null, 2));
14081408
expect(result.data[0]).not.toMatch(/orders_h2021053000/);
14091409
expect(result.data[0]).toMatch(/orders_h2021053100/);
1410-
expect(result.data[0]).toMatch(/orders_h2021060100_uozkyaur_d004iq51/);
1410+
expect(result.data[0]).toMatch(/orders_h2021060100_fv2h1pdp_3wsilqun/);
14111411
});
14121412

14131413
test('real-time sealing partitions', async () => {
@@ -1531,7 +1531,7 @@ describe('QueryOrchestrator', () => {
15311531
external: true,
15321532
}],
15331533
renewQuery: true,
1534-
1534+
15351535
requestId: 'basic'
15361536
};
15371537
const promise = queryOrchestrator.fetchQuery(query);

0 commit comments

Comments
 (0)