Skip to content

Commit 46fed32

Browse files
committed
fix preaggs again
1 parent 23a2f89 commit 46fed32

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ interface CubeDefinition {
2121
segments?: Record<string, any>;
2222
hierarchies?: Record<string, any>;
2323
preAggregations?: Record<string, any>;
24+
// eslint-disable-next-line camelcase
25+
pre_aggregations?: Record<string, any>;
2426
joins?: Record<string, any>;
2527
accessPolicy?: any[];
2628
includes?: any;
@@ -132,11 +134,13 @@ export class CubeSymbols {
132134
// unexpected results, so we can not use common approach with allDefinitions('preAggregations') here.
133135
if (!preAggregations) {
134136
const parentPreAggregations = cubeDefinition.extends ? super.preAggregations : null;
137+
// Unfortunately, cube is not camelized yet at this point :(
138+
const localPreAggregations = cubeDefinition.preAggregations || cubeDefinition.pre_aggregations;
135139

136140
if (parentPreAggregations) {
137-
preAggregations = { ...cubeDefinition.preAggregations, ...parentPreAggregations, ...cubeDefinition.preAggregations };
141+
preAggregations = { ...localPreAggregations, ...parentPreAggregations, ...localPreAggregations };
138142
} else {
139-
preAggregations = { ...cubeDefinition.preAggregations };
143+
preAggregations = { ...localPreAggregations };
140144
}
141145
}
142146
return preAggregations;
@@ -221,9 +225,10 @@ export class CubeSymbols {
221225

222226
// We have 2 different properties that are mutually exclusive: `sqlTable` & `sql`
223227
// And if in extending cube one of them is defined - we need to hide the other from parent cube definition
224-
if (cubeDefinition.sqlTable && parentCube.sql) {
228+
// Unfortunately, cube is not camelized yet at this point :(
229+
if ((cubeDefinition.sqlTable || cubeDefinition.sql_table) && parentCube.sql) {
225230
cubeObject.sql = undefined;
226-
} else if (cubeDefinition.sql && parentCube.sqlTable) {
231+
} else if (cubeDefinition.sql && (parentCube.sqlTable || parentCube.sql_table)) {
227232
cubeObject.sqlTable = undefined;
228233
}
229234
}

0 commit comments

Comments
 (0)