fix(query-orchestrator): replace pre-aggregation usage aliases before base table names (fixes #10929)#10942
Open
mystichronicle wants to merge 2 commits into
Open
fix(query-orchestrator): replace pre-aggregation usage aliases before base table names (fixes #10929)#10942mystichronicle wants to merge 2 commits into
mystichronicle wants to merge 2 commits into
Conversation
added 2 commits
May 23, 2026 20:52
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates TypeScript module resolution and internal typings in cubejs-query-orchestrator, and fixes a pre-aggregation table name replacement edge case (with new test coverage).
Changes:
- Adjusts
@cubejs-backend/*TS path mappings to include additional package sources. - Introduces a local
LoggerFntype and switches orchestrator modules to use it instead of@cubejs-backend/shared. - Fixes pre-aggregation table replacement ordering by sorting table names by length and adds a regression test.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.base.json | Adds additional source roots to @cubejs-backend/* path mapping. |
| packages/cubejs-query-orchestrator/test/unit/QueryQueue.abstract.ts | Removes dependency on concrete Cubestore connection type in tests via a lightweight “like” type. |
| packages/cubejs-query-orchestrator/test/unit/QueryCache.abstract.ts | Adds regression test for alias/base-table replacement ordering. |
| packages/cubejs-query-orchestrator/src/orchestrator/QueryQueue.ts | Refactors externalId derivation and changes typing/import source for LoggerFn. |
| packages/cubejs-query-orchestrator/src/orchestrator/QueryOrchestrator.ts | Switches LoggerFn import to local type. |
| packages/cubejs-query-orchestrator/src/orchestrator/QueryCache.ts | Sorts temp-table mappings by key length before replacement; switches LoggerFn import. |
| packages/cubejs-query-orchestrator/src/orchestrator/PreAggregations.ts | Switches LoggerFn import to local type. |
| packages/cubejs-query-orchestrator/src/orchestrator/PreAggregationPartitionRangeLoader.ts | Switches LoggerFn import to local type. |
| packages/cubejs-query-orchestrator/src/orchestrator/PreAggregationLoader.ts | Switches LoggerFn import to local type. |
| packages/cubejs-query-orchestrator/src/orchestrator/Logger.ts | Adds local LoggerFn/LoggerFnParams type definitions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // query (initialized by the /cubejs-system/v1/pre-aggregations/jobs | ||
| // endpoint). | ||
| let result = !query.forceBuild && await queueConnection.getResult(queryKey, options.externalId); | ||
| let result = !query.forceBuild && await (queueConnection as any).getResult(queryKey, externalId); |
| const idx = options.requestId.lastIndexOf('-span-'); | ||
| return idx !== -1 ? options.requestId.substring(0, idx) : options.requestId; | ||
| })() | ||
| : undefined; |
| @@ -0,0 +1,5 @@ | |||
| export type LoggerFnParams = { | |||
| [key: string]: any; | |||
Comment on lines
+16
to
22
| "packages/cubejs-backend-shared/src", | ||
| "packages/cubejs-base-driver/src", | ||
| "packages/cubejs-cubestore-driver/src", | ||
| "rust/js-wrapper", | ||
| "packages/cubejs-api-gateway/src", | ||
| "packages/cubejs-cli/src", | ||
| "packages/cubejs-query-orchestrator/src", |
Contributor
Author
|
@KSDaemon Could you please review this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Check List
Issue Reference this PR resolves
#10929
Description of Changes Made (if issue reference is not provided)
Fixed the
__usage_Npre-aggregation alias replacement path so usage-specific table names are rewritten before their base table name. This prevents the final/loadquery from resolving to a missing__usage_0relation in Tesseract multi-fact views with paired source-db pre-aggregations.Also added a regression test covering the alias replacement order, and resolved the orchestrator package typecheck issues that surfaced while validating the change.