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

fix(api-gateway): fixes an issue where queries t… #8060

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
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: 4 additions & 0 deletions packages/cubejs-api-gateway/src/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@

protected readonly playgroundAuthSecret?: string;

protected readonly event: (name: string, props?: object) => void;

Check warning on line 150 in packages/cubejs-api-gateway/src/gateway.ts

View workflow job for this annotation

GitHub Actions / lint

'name' is defined but never used. Allowed unused args must match /^_.*/u

Check warning on line 150 in packages/cubejs-api-gateway/src/gateway.ts

View workflow job for this annotation

GitHub Actions / lint

'props' is defined but never used. Allowed unused args must match /^_.*/u

public constructor(
protected readonly apiSecret: string,
Expand Down Expand Up @@ -180,7 +180,7 @@
this.contextRejectionMiddleware = options.contextRejectionMiddleware || (async (req, res, next) => next());
this.wsContextAcceptor = options.wsContextAcceptor || (() => ({ accepted: true }));
// eslint-disable-next-line @typescript-eslint/no-empty-function
this.event = options.event || function () {};

Check warning on line 183 in packages/cubejs-api-gateway/src/gateway.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected unnamed function
}

public initApp(app: ExpressApplication) {
Expand Down Expand Up @@ -1420,9 +1420,13 @@
if (normalizedQuery.total) {
const normalizedTotal = structuredClone(normalizedQuery);
normalizedTotal.totalQuery = true;

delete normalizedTotal.order;

Check warning on line 1424 in packages/cubejs-api-gateway/src/gateway.ts

View check run for this annotation

Codecov / codecov/patch

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

Added line #L1424 was not covered by tests

normalizedTotal.limit = null;
normalizedTotal.rowLimit = null;
normalizedTotal.offset = null;

const [totalQuery] = await this.getSqlQueriesInternal(
context,
[normalizedTotal],
Expand Down Expand Up @@ -1689,7 +1693,7 @@
const {
context,
res,
apiType = 'sql',

Check warning on line 1696 in packages/cubejs-api-gateway/src/gateway.ts

View workflow job for this annotation

GitHub Actions / lint

'apiType' is assigned a value but never used. Allowed unused vars must match /^_.*/u
} = request;
const requestStarted = new Date();

Expand Down
2 changes: 1 addition & 1 deletion packages/cubejs-schema-compiler/src/adapter/BaseQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ export class BaseQuery {
}

defaultOrder() {
if (this.options.preAggregationQuery) {
if (this.options.preAggregationQuery || this.options.totalQuery) {
return [];
}

Expand Down
Loading