Skip to content

Commit 0d5fa03

Browse files
committed
feat(schema-compiler)!: Set preAggregation.allowNonStrictDateRangeMatch = true by default
1 parent 8c4566c commit 0d5fa03

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

packages/cubejs-backend-shared/src/env.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,9 @@ const variables: Record<string, (...args: any) => any> = {
226226
transpilationWorkerThreads: () => get('CUBEJS_TRANSPILATION_WORKER_THREADS')
227227
.default('false')
228228
.asBoolStrict(),
229+
allowNonStrictDateRangeMatching: () => get('CUBEJS_PRE_AGGREGATIONS_ALLOW_NON_STRICT_DATE_RANGE_MATCH')
230+
.default('true')
231+
.asBoolStrict(),
229232
transpilationWorkerThreadsCount: () => get('CUBEJS_TRANSPILATION_WORKER_THREADS_COUNT')
230233
.default('0')
231234
.asInt(),

packages/cubejs-schema-compiler/src/compiler/CubeSymbols.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,12 @@ export class CubeSymbols {
246246
preAggregation.type = 'rollup';
247247
}
248248

249+
if (preAggregation.allowNonStrictDateRangeMatch === undefined &&
250+
['originalSql', 'rollupJoin', 'rollup'].includes(preAggregation.type) &&
251+
(preAggregation.timeDimension || preAggregation.timeDimensions)) {
252+
preAggregation.allowNonStrictDateRangeMatch = getEnv('allowNonStrictDateRangeMatching');
253+
}
254+
249255
if (preAggregation.scheduledRefresh === undefined && preAggregation.type !== 'rollupJoin' && preAggregation.type !== 'rollupLambda') {
250256
preAggregation.scheduledRefresh = getEnv('scheduledRefreshDefault');
251257
}

packages/cubejs-schema-compiler/test/unit/schema.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ describe('Schema Testing', () => {
6969
refreshRangeEnd: {
7070
sql: expect.any(Function),
7171
},
72+
allowNonStrictDateRangeMatch: true,
7273
},
7374
countCreatedAt: {
7475
external: true,
@@ -102,6 +103,7 @@ describe('Schema Testing', () => {
102103
refreshRangeEnd: {
103104
sql: expect.any(Function),
104105
},
106+
allowNonStrictDateRangeMatch: true,
105107
}
106108
});
107109
});
@@ -128,6 +130,7 @@ describe('Schema Testing', () => {
128130
refreshRangeEnd: {
129131
sql: expect.any(Function),
130132
},
133+
allowNonStrictDateRangeMatch: true,
131134
},
132135
countCreatedAt: {
133136
// because preview
@@ -162,6 +165,7 @@ describe('Schema Testing', () => {
162165
refreshRangeEnd: {
163166
sql: expect.any(Function),
164167
},
168+
allowNonStrictDateRangeMatch: true,
165169
}
166170
});
167171
});

0 commit comments

Comments
 (0)