Skip to content

Commit e1d3b5c

Browse files
authored
chore: metaOnly flag in pre-aggregations api (#9461)
1 parent 1c15a06 commit e1d3b5c

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

packages/cubejs-api-gateway/src/gateway.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ class ApiGateway {
440440
app.get('/cubejs-system/v1/pre-aggregations', systemMiddlewares, systemAsyncHandler(async (req, res) => {
441441
await this.getPreAggregations({
442442
cacheOnly: !!req.query.cacheOnly,
443+
metaOnly: !!req.query.metaOnly,
443444
context: req.context,
444445
res: this.resToResultFn(res)
445446
});
@@ -619,7 +620,7 @@ class ApiGateway {
619620
}
620621
}
621622

622-
public async getPreAggregations({ cacheOnly, context, res }: { cacheOnly?: boolean, context: RequestContext, res: ResponseResultFn }) {
623+
public async getPreAggregations({ cacheOnly, metaOnly, context, res }: { cacheOnly?: boolean, metaOnly?: boolean, context: RequestContext, res: ResponseResultFn }) {
623624
const requestStarted = new Date();
624625
try {
625626
const compilerApi = await this.getCompilerApi(context);
@@ -634,6 +635,7 @@ class ApiGateway {
634635
preAggregations: preAggregations.map(p => ({
635636
id: p.id,
636637
cacheOnly,
638+
metaOnly
637639
}))
638640
},
639641
)

packages/cubejs-api-gateway/src/query.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ const queryPreAggregationsSchema = Joi.object().keys({
280280
preAggregations: Joi.array().items(Joi.object().keys({
281281
id: Joi.string().required(),
282282
cacheOnly: Joi.boolean(),
283+
metaOnly: Joi.boolean(),
283284
partitions: Joi.array().items(Joi.string()),
284285
refreshRange: Joi.array().items(Joi.string()).length(2), // TODO: Deprecate after cloud changes
285286
}))

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ type PreAggregationsQueryingOptions = {
3333
preAggregations: {
3434
id: string,
3535
cacheOnly?: boolean,
36+
metaOnly?: boolean,
3637
partitions?: string[]
3738
}[],
3839
forceBuildPreAggregations?: boolean,
@@ -391,7 +392,17 @@ export class RefreshScheduler {
391392

392393
return Promise.all(preAggregations.map(preAggregation => async () => {
393394
const { timezones } = queryingOptions;
394-
const { partitions: partitionsFilter, cacheOnly } = preAggregationsQueryingOptions[preAggregation.id] || {};
395+
const { partitions: partitionsFilter, cacheOnly, metaOnly } = preAggregationsQueryingOptions[preAggregation.id] || {};
396+
397+
if (metaOnly) {
398+
return {
399+
timezones,
400+
preAggregation,
401+
partitions: [],
402+
errors: [],
403+
partitionsWithDependencies: []
404+
};
405+
}
395406

396407
const type = preAggregation?.preAggregation?.type;
397408
const isEphemeralPreAggregation = type === 'rollupJoin' || type === 'rollupLambda';

0 commit comments

Comments
 (0)