Skip to content

Commit d263207

Browse files
authored
chore: Fix system queries for rollupLambda (cube-js#5322)
1 parent 4675177 commit d263207

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

packages/cubejs-client-core/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ declare module '@cubejs-client/core' {
151151
measureToLeafMeasures?: Record<string, LeafMeasure[]>;
152152
};
153153

154-
export type PreAggregationType = 'rollup' | 'rollupJoin' | 'originalSql';
154+
export type PreAggregationType = 'rollup' | 'rollupJoin' | 'rollupLambda' | 'originalSql';
155155

156156
type UsedPreAggregation = {
157157
targetTableName: string;

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,10 @@ export class RefreshScheduler {
302302
const { timezones } = queryingOptions;
303303
const { partitions: partitionsFilter, cacheOnly } = preAggregationsQueryingOptions[preAggregation.id] || {};
304304

305-
const isRollupJoin = preAggregation?.preAggregation?.type === 'rollupJoin';
305+
const type = preAggregation?.preAggregation?.type;
306+
const isEphemeralPreAggregation = type === 'rollupJoin' || type === 'rollupLambda';
306307

307-
const queriesForPreAggregation: RefreshQueries[] = !isRollupJoin && (await Promise.all(
308+
const queriesForPreAggregation: RefreshQueries[] = !isEphemeralPreAggregation && (await Promise.all(
308309
timezones.map(async timezone => this.refreshQueriesForPreAggregation(
309310
context,
310311
compilerApi,

packages/cubejs-testing/test/smoke-lambda.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import R from 'ramda';
22
import { StartedTestContainer } from 'testcontainers';
33
import { pausePromise } from '@cubejs-backend/shared';
4+
import fetch from 'node-fetch';
45
import { PostgresDBRunner } from '@cubejs-backend/testing-shared';
56
import cubejs, { CubejsApi, Query } from '@cubejs-client/core';
67
// eslint-disable-next-line import/no-extraneous-dependencies
@@ -278,4 +279,15 @@ describe('lambda', () => {
278279
await runScheduledRefresh(client);
279280
await checkCubestoreState(cubestore);
280281
});
282+
283+
it('Pre-aggregations API', async () => {
284+
const preAggs = await fetch(`${birdbox.configuration.playgroundUrl}/cubejs-system/v1/pre-aggregations`, {
285+
method: 'GET',
286+
headers: {
287+
Authorization: ''
288+
},
289+
});
290+
console.log(await preAggs.json());
291+
expect(preAggs.status).toBe(200);
292+
});
281293
});

0 commit comments

Comments
 (0)