Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: metaOnly flag in pre-aggregations api #9128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/cubejs-api-gateway/src/gateway.ts
Original file line number Diff line number Diff line change
@@ -440,6 +440,7 @@ class ApiGateway {
app.get('/cubejs-system/v1/pre-aggregations', systemMiddlewares, systemAsyncHandler(async (req, res) => {
await this.getPreAggregations({
cacheOnly: !!req.query.cacheOnly,
metaOnly: !!req.query.metaOnly,
context: req.context,
res: this.resToResultFn(res)
});
@@ -619,7 +620,7 @@ class ApiGateway {
}
}

public async getPreAggregations({ cacheOnly, context, res }: { cacheOnly?: boolean, context: RequestContext, res: ResponseResultFn }) {
public async getPreAggregations({ cacheOnly, metaOnly, context, res }: { cacheOnly?: boolean, metaOnly?: boolean, context: RequestContext, res: ResponseResultFn }) {
const requestStarted = new Date();
try {
const compilerApi = await this.getCompilerApi(context);
@@ -635,6 +636,7 @@ class ApiGateway {
preAggregations: preAggregations.map(p => ({
id: p.id,
cacheOnly,
metaOnly
}))
},
)
1 change: 1 addition & 0 deletions packages/cubejs-api-gateway/src/query.js
Original file line number Diff line number Diff line change
@@ -290,6 +290,7 @@ const queryPreAggregationsSchema = Joi.object().keys({
preAggregations: Joi.array().items(Joi.object().keys({
id: Joi.string().required(),
cacheOnly: Joi.boolean(),
metaOnly: Joi.boolean(),
partitions: Joi.array().items(Joi.string()),
refreshRange: Joi.array().items(Joi.string()).length(2), // TODO: Deprecate after cloud changes
}))
13 changes: 12 additions & 1 deletion packages/cubejs-server-core/src/core/RefreshScheduler.ts
Original file line number Diff line number Diff line change
@@ -33,6 +33,7 @@ type PreAggregationsQueryingOptions = {
preAggregations: {
id: string,
cacheOnly?: boolean,
metaOnly?: boolean,
partitions?: string[]
}[],
forceBuildPreAggregations?: boolean,
@@ -391,7 +392,17 @@ export class RefreshScheduler {

return Promise.all(preAggregations.map(preAggregation => async () => {
const { timezones } = queryingOptions;
const { partitions: partitionsFilter, cacheOnly } = preAggregationsQueryingOptions[preAggregation.id] || {};
const { partitions: partitionsFilter, cacheOnly, metaOnly } = preAggregationsQueryingOptions[preAggregation.id] || {};

if (metaOnly) {
return {
timezones,
preAggregation,
partitions: [],
errors: [],
partitionsWithDependencies: []
};
}

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