@@ -290,7 +290,7 @@ func (s *Stage) saveQueryJsonFile(result *QueryResult) {
290
290
querySourceStr := s .querySourceString (result )
291
291
{
292
292
queryJsonFile , err := os .OpenFile (
293
- filepath .Join (s .States . OutputPath , querySourceStr )+ ".json" ,
293
+ filepath .Join (s .OutputPath , querySourceStr )+ ".json" ,
294
294
utils .OpenNewFileFlags , 0644 )
295
295
checkErr (err )
296
296
if err == nil {
@@ -302,7 +302,7 @@ func (s *Stage) saveQueryJsonFile(result *QueryResult) {
302
302
}
303
303
if result .QueryError != nil {
304
304
queryErrorFile , err := os .OpenFile (
305
- filepath .Join (s .States . OutputPath , querySourceStr )+ ".error.json" ,
305
+ filepath .Join (s .OutputPath , querySourceStr )+ ".error.json" ,
306
306
utils .OpenNewFileFlags , 0644 )
307
307
checkErr (err )
308
308
if err == nil {
@@ -332,7 +332,7 @@ func (s *Stage) saveColumnMetadataFile(qr *presto.QueryResults, result *QueryRes
332
332
}
333
333
}()
334
334
columnMetadataFile , ioErr := os .OpenFile (
335
- filepath .Join (s .States . OutputPath , querySourceStr )+ ".cols.json" ,
335
+ filepath .Join (s .OutputPath , querySourceStr )+ ".cols.json" ,
336
336
utils .OpenNewFileFlags , 0644 )
337
337
if ioErr != nil {
338
338
return ioErr
@@ -372,3 +372,19 @@ func (s *Stage) querySourceString(result *QueryResult) (sourceStr string) {
372
372
}
373
373
return
374
374
}
375
+
376
+ func (s * Stage ) createNextStagesOutputDirectories () {
377
+ // Create parent stage id file path
378
+ utils .PrepareOutputDirectory (s .OutputPath )
379
+ for _ , nextStage := range s .NextStages {
380
+ // Construct the output directory path
381
+ stageOutputPath := filepath .Join (s .OutputPath , nextStage .Id )
382
+ nextStage .OutputPath = stageOutputPath
383
+
384
+ // Create the directory
385
+ utils .PrepareOutputDirectory (stageOutputPath )
386
+
387
+ // Recursively call the function on the child stage
388
+ nextStage .createNextStagesOutputDirectories ()
389
+ }
390
+ }
0 commit comments