Skip to content

Commit 577aa38

Browse files
committed
fix(schema-compiler): fix FILTER_PARAMS flow in pre aggregations filtering
1 parent 9ae3852 commit 577aa38

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/cubejs-schema-compiler/src/adapter/BaseQuery.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2866,8 +2866,11 @@ export class BaseQuery {
28662866

28672867
newSubQueryForCube(cube, options) {
28682868
if (this.options.queryFactory) {
2869-
options.paramAllocator = null;
2870-
return this.options.queryFactory.createQuery(cube, this.compilers, this.subQueryOptions(options));
2869+
// When dealing with rollup joins, it's crucial to use the correct parameter allocator for the specific cube in use.
2870+
// By default, we'll use BaseQuery, but it's important to note that different databases (Oracle, PostgreSQL, MySQL, Druid, etc.)
2871+
// have unique parameter allocator symbols. Using the wrong allocator can break the query, especially when rollup joins involve
2872+
// different cubes that require different allocators.
2873+
return this.options.queryFactory.createQuery(cube, this.compilers, { ...this.subQueryOptions(options), paramAllocator: null });
28712874
}
28722875

28732876
return this.newSubQuery(options);
@@ -3522,7 +3525,7 @@ export class BaseQuery {
35223525
if (preAggregation.refreshKey) {
35233526
if (preAggregation.refreshKey.sql) {
35243527
return [
3525-
this.paramAllocator.buildSqlAndParams(
3528+
preAggregationQueryForSql.paramAllocator.buildSqlAndParams(
35263529
preAggregationQueryForSql.evaluateSql(cube, preAggregation.refreshKey.sql)
35273530
).concat({
35283531
external: false,

0 commit comments

Comments
 (0)