File tree Expand file tree Collapse file tree 3 files changed +21
-21
lines changed
cubejs-server-core/src/core Expand file tree Collapse file tree 3 files changed +21
-21
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,6 @@ import {
3838 PreAggsSelector ,
3939 PreAggJob ,
4040 PreAggJobStatusItem ,
41- PreAggJobStatusObject ,
4241 PreAggJobStatusResponse ,
4342 SqlApiRequest , MetaResponseResultFn ,
4443} from './types/request' ;
@@ -1044,19 +1043,24 @@ class ApiGateway {
10441043 token : string ,
10451044 ) : Promise < string > {
10461045 const preaggs = await compiler . preAggregations ( ) ;
1047- const preagg = preaggs . filter ( pa => pa . id === job . preagg ) [ 0 ] ;
1048- const cube = metadata . cubeDefinitions [ preagg . cube ] ;
1049- const [ , status ] : [ boolean , string ] =
1050- await orchestrator . isPartitionExist (
1051- requestId ,
1052- preagg . preAggregation . external ,
1053- cube . dataSource ,
1054- compiler . preAggregationsSchema ,
1055- job . target ,
1056- job . key ,
1057- token ,
1058- ) ;
1059- return status ;
1046+ const preagg = preaggs . find ( pa => pa . id === job . preagg ) ;
1047+ if ( preagg ) {
1048+ const cube = metadata . cubeDefinitions [ preagg . cube ] ;
1049+ const [ , status ] : [ boolean , string ] =
1050+ await orchestrator . isPartitionExist (
1051+ requestId ,
1052+ preagg . preAggregation . external ,
1053+ cube . dataSource ,
1054+ compiler . preAggregationsSchema ,
1055+ job . target ,
1056+ job . key ,
1057+ token ,
1058+ ) ;
1059+
1060+ return status ;
1061+ }
1062+
1063+ return 'pre_agg_not_found' ;
10601064 }
10611065
10621066 public async getPreAggregationsInQueue (
Original file line number Diff line number Diff line change @@ -179,7 +179,7 @@ type PreAggsJobsRequest = {
179179
180180type PreAggJobStatusItemNotFound = {
181181 token : string ;
182- status : 'not_found' ;
182+ status : 'not_found' | 'pre_agg_not_found' ;
183183} ;
184184
185185type PreAggJobStatusItemFound = {
@@ -192,11 +192,7 @@ type PreAggJobStatusItemFound = {
192192type PreAggJobStatusItem = PreAggJobStatusItemNotFound | PreAggJobStatusItemFound ;
193193
194194type PreAggJobStatusObject = {
195- [ token : string ] : {
196- table : string ;
197- status : string ;
198- selector : PreAggsSelector ;
199- }
195+ [ token : string ] : Omit < PreAggJobStatusItem , 'token' >
200196} ;
201197
202198type PreAggJobStatusResponse =
Original file line number Diff line number Diff line change @@ -725,7 +725,7 @@ export class RefreshScheduler {
725725 public async getCachedBuildJobs (
726726 context : RequestContext ,
727727 tokens : string [ ] ,
728- ) : Promise < { job : PreAggJob , token : string } [ ] > {
728+ ) : Promise < { job : PreAggJob | null , token : string } [ ] > {
729729 const orchestratorApi = await this . serverCore . getOrchestratorApi ( context ) ;
730730 const jobsPromise = Promise . all (
731731 tokens . map ( async ( token ) => {
You can’t perform that action at this time.
0 commit comments