Skip to content
Open
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
2 changes: 1 addition & 1 deletion packages/cubejs-api-gateway/src/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,7 @@ class ApiGateway {
rewrittenQuery = this.evalMemberExpressionsInQuery(rewrittenQuery);
}

return normalizeQuery(rewrittenQuery, persistent);
return normalizeQuery(rewrittenQuery, persistent, cacheMode);
}
)
);
Expand Down
2 changes: 1 addition & 1 deletion packages/cubejs-api-gateway/src/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ function normalizeQueryCacheMode(query, cacheMode) {
* @returns {import('./types/query').NormalizedQuery}
*/
const normalizeQuery = (query, persistent, cacheMode) => {
query = normalizeQueryCacheMode(query);
query = normalizeQueryCacheMode(query, cacheMode);
const { error } = querySchema.validate(query);
if (error) {
throw new UserError(`Invalid query format: ${error.message || error.toString()}`);
Expand Down
30 changes: 19 additions & 11 deletions packages/cubejs-query-orchestrator/src/orchestrator/QueryCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,17 +251,21 @@ export class QueryCache {
) {
if (queryBody.persistent) {
// stream will be returned here
return this.queryWithRetryAndRelease(query, values, {
cacheKey,
priority: queuePriority,
external: queryBody.external,
requestId: queryBody.requestId,
persistent: queryBody.persistent,
dataSource: queryBody.dataSource,
useCsvQuery: queryBody.useCsvQuery,
lambdaTypes: queryBody.lambdaTypes,
aliasNameToMember: queryBody.aliasNameToMember,
});
return this.queryWithRetryAndRelease(
query,
values,
{
cacheKey,
priority: queuePriority,
external: queryBody.external,
requestId: queryBody.requestId,
persistent: queryBody.persistent,
dataSource: queryBody.dataSource,
useCsvQuery: queryBody.useCsvQuery,
lambdaTypes: queryBody.lambdaTypes,
aliasNameToMember: queryBody.aliasNameToMember,
}
);
} else {
return {
data: await this.queryWithRetryAndRelease(
Expand Down Expand Up @@ -291,6 +295,7 @@ export class QueryCache {
cacheKey,
renewalThreshold,
{
forceNoCache,
external: queryBody.external,
requestId: queryBody.requestId,
dataSource: queryBody.dataSource,
Expand All @@ -308,6 +313,7 @@ export class QueryCache {
cacheKey,
renewalThreshold,
{
forceNoCache,
external: queryBody.external,
requestId: queryBody.requestId,
dataSource: queryBody.dataSource,
Expand Down Expand Up @@ -770,6 +776,7 @@ export class QueryCache {
requestId?: string,
skipRefreshKeyWaitForRenew?: boolean,
external?: boolean,
forceNoCache?: boolean,
dataSource: string,
useCsvQuery?: boolean,
lambdaTypes?: TableStructure,
Expand Down Expand Up @@ -803,6 +810,7 @@ export class QueryCache {
this.queryRedisKey([query, values]),
],
waitForRenew: true,
forceNoCache: options.forceNoCache,
external: options.external,
requestId: options.requestId,
dataSource: options.dataSource,
Expand Down
6 changes: 5 additions & 1 deletion packages/cubejs-schema-compiler/src/adapter/BaseQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ export class BaseQuery {
}
const hasMemberExpressions = this.allMembersConcat(false).some(m => m.isMemberExpression);

if (!this.options.preAggregationQuery && !this.customSubQueryJoins.length && !hasMemberExpressions) {
if (this.options.cacheMode !== 'no-cache' && !this.options.preAggregationQuery && !this.customSubQueryJoins.length && !hasMemberExpressions) {
preAggForQuery =
this.preAggregations.findPreAggregationForQuery();
if (this.options.disableExternalPreAggregations && preAggForQuery?.preAggregation.external) {
Expand Down Expand Up @@ -844,6 +844,10 @@ export class BaseQuery {
}

externalPreAggregationQuery() {
if (this.options.cacheMode === 'no-cache') {
return false;
}

if (!this.options.preAggregationQuery && !this.options.disableExternalPreAggregations && this.externalQueryClass) {
const preAggregationForQuery = this.preAggregations.findPreAggregationForQuery();
if (preAggregationForQuery?.preAggregation.external) {
Expand Down
4 changes: 1 addition & 3 deletions packages/cubejs-server-core/src/core/OrchestratorApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,7 @@ export class OrchestratorApi {
*/
public async testConnection() {
if (this.options.rollupOnlyMode) {
return Promise.all([
this.testDriverConnection(this.options.externalDriverFactory, DriverType.External),
]);
return this.testDriverConnection(this.options.externalDriverFactory, DriverType.External);
} else {
return Promise.all([
...Object.keys(this.seenDataSources).map(
Expand Down
Loading