From 8d7454cb72bfa18a2c71e0919c5c5f4afa2a0e19 Mon Sep 17 00:00:00 2001 From: Alex Vasilev Date: Fri, 10 Jan 2025 17:27:07 -0800 Subject: [PATCH] fix(gateway): skip query rewrite during dry run --- packages/cubejs-api-gateway/src/gateway.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index a00b77c861674..4af6bb3f777ca 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -1161,6 +1161,7 @@ class ApiGateway { context: RequestContext, persistent = false, memberExpressions: boolean = false, + skipQueryRewrite: boolean = false, ): Promise<[QueryType, NormalizedQuery[]]> { let query = this.parseQueryParam(inputQuery); @@ -1199,6 +1200,11 @@ class ApiGateway { } const normalizedQuery = normalizeQuery(currentQuery, persistent); + + if (skipQueryRewrite) { + return normalizedQuery; + } + let evaluatedQuery = normalizedQuery; if (hasExpressionsInQuery) { @@ -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( normalizedQueries.map(async (normalizedQuery) => (await this.getCompilerApi(context)).getSql(