Skip to content

Commit

Permalink
fix(gateway): skip query rewrite during dry run
Browse files Browse the repository at this point in the history
  • Loading branch information
vasilev-alex committed Jan 11, 2025
1 parent d8d8de2 commit 8d7454c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/cubejs-api-gateway/src/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,7 @@ class ApiGateway {
context: RequestContext,
persistent = false,
memberExpressions: boolean = false,
skipQueryRewrite: boolean = false,
): Promise<[QueryType, NormalizedQuery[]]> {
let query = this.parseQueryParam(inputQuery);

Expand Down Expand Up @@ -1199,6 +1200,11 @@ class ApiGateway {
}

const normalizedQuery = normalizeQuery(currentQuery, persistent);

if (skipQueryRewrite) {
return normalizedQuery;
}

let evaluatedQuery = normalizedQuery;

if (hasExpressionsInQuery) {
Expand Down Expand Up @@ -1454,7 +1460,7 @@ class ApiGateway {
try {
await this.assertApiScope('data', context.securityContext);

const [queryType, normalizedQueries] = await this.getNormalizedQueries(query, context);
const [queryType, normalizedQueries] = await this.getNormalizedQueries(query, context, undefined, undefined, true);

const sqlQueries = await Promise.all<any>(
normalizedQueries.map(async (normalizedQuery) => (await this.getCompilerApi(context)).getSql(
Expand Down

0 comments on commit 8d7454c

Please sign in to comment.