Skip to content
Closed
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
11 changes: 8 additions & 3 deletions packages/cubejs-schema-compiler/src/adapter/BaseQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -2655,9 +2655,14 @@ export class BaseQuery {
}

newSubQueryForCube(cube, options) {
return this.options.queryFactory
? this.options.queryFactory.createQuery(cube, this.compilers, this.subQueryOptions(options))
: this.newSubQuery(options);
if (this.options.queryFactory) {
// When dealing with rollup joins, it's crucial to use the correct parameter allocator for the specific cube in use.
// By default, we'll use BaseQuery, but it's important to note that different databases (Oracle, PostgreSQL, MySQL, Druid, etc.)
// have unique parameter allocator symbols. Using the wrong allocator can break the query, especially when rollup joins involve
// different cubes that require different allocators.
return this.options.queryFactory.createQuery(cube, this.compilers, { ...this.subQueryOptions(options), paramAllocator: undefined });
Copy link
Contributor Author

@pauldheinrichs pauldheinrichs May 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unset the paramAllocator set by this.subQueryOptions to allow QueryClasses to assume their default paramAllocator class

}
return this.newSubQuery(options);
}

subQueryOptions(options) {
Expand Down