@@ -290,6 +290,37 @@ class TFmrCoordinator: public IFmrCoordinator {
290
290
};
291
291
}
292
292
293
+ std::vector<TTaskTableRef> TaskInputTablesFromOperationInputTables (const std::vector<TOperationTableRef>& operationTables) {
294
+ std::vector<TTaskTableRef> taskInputTables;
295
+ for (auto & elem: operationTables) {
296
+ if (const TYtTableRef* ytTableRef = std::get_if<TYtTableRef>(&elem)) {
297
+ taskInputTables.emplace_back (*ytTableRef);
298
+ } else {
299
+ TFmrTableRef fmrTableRef = std::get<TFmrTableRef>(elem);
300
+ TString inputTableId = fmrTableRef.FmrTableId .Id ;
301
+ TFmrTableInputRef tableInput{
302
+ .TableId = inputTableId,
303
+ .TableRanges = {GetTableRangeFromId (inputTableId)}
304
+ };
305
+ taskInputTables.emplace_back (tableInput);
306
+ }
307
+ }
308
+ return taskInputTables;
309
+ }
310
+
311
+ std::vector<TFmrTableOutputRef> TaskOutputTablesFromOperationOutputTables (const std::vector<TFmrTableRef>& operationTables) {
312
+ std::vector<TFmrTableOutputRef> taskOutputTables;
313
+ for (auto & fmrTableRef: operationTables) {
314
+ TString outputTableId = fmrTableRef.FmrTableId .Id ;
315
+ TFmrTableOutputRef tableOutput{
316
+ .TableId = outputTableId,
317
+ .PartId = GetTableRangeFromId (outputTableId).PartId
318
+ };
319
+ taskOutputTables.emplace_back (tableOutput);
320
+ }
321
+ return taskOutputTables;
322
+ }
323
+
293
324
TTaskParams MakeDefaultTaskParamsFromOperation (const TOperationParams& operationParams) {
294
325
if (const TUploadOperationParams* uploadOperationParams = std::get_if<TUploadOperationParams>(&operationParams)) {
295
326
TUploadTaskParams uploadTaskParams{};
@@ -311,27 +342,20 @@ class TFmrCoordinator: public IFmrCoordinator {
311
342
};
312
343
downloadTaskParams.Output = fmrTableOutput;
313
344
return downloadTaskParams;
314
- } else {
315
- TMergeOperationParams mergeOperationParams = std::get<TMergeOperationParams>(operationParams);
345
+ } else if (const TMergeOperationParams* mergeOperationParams = std::get_if<TMergeOperationParams>(&operationParams)) {
316
346
TMergeTaskParams mergeTaskParams;
317
- std::vector<TTaskTableRef> mergeInputTasks;
318
- for (auto & elem: mergeOperationParams.Input ) {
319
- if (const TYtTableRef* ytTableRef = std::get_if<TYtTableRef>(&elem)) {
320
- mergeInputTasks.emplace_back (*ytTableRef);
321
- } else {
322
- TFmrTableRef fmrTableRef = std::get<TFmrTableRef>(elem);
323
- TString inputTableId = fmrTableRef.FmrTableId .Id ;
324
- TFmrTableInputRef tableInput{
325
- .TableId = inputTableId,
326
- .TableRanges = {GetTableRangeFromId (inputTableId)}
327
- };
328
- mergeInputTasks.emplace_back (tableInput);
329
- }
330
- }
331
- mergeTaskParams.Input = mergeInputTasks;
347
+ mergeTaskParams.Input = TaskInputTablesFromOperationInputTables (mergeOperationParams->Input );
332
348
TFmrTableOutputRef outputTable;
333
- mergeTaskParams.Output = TFmrTableOutputRef{.TableId = mergeOperationParams. Output .FmrTableId .Id };
349
+ mergeTaskParams.Output = TFmrTableOutputRef{.TableId = mergeOperationParams-> Output .FmrTableId .Id };
334
350
return mergeTaskParams;
351
+ } else if (const TMapOperationParams* mapOperationParams = std::get_if<TMapOperationParams>(&operationParams)) {
352
+ TMapTaskParams mapTaskParams;
353
+ mapTaskParams.Input = TaskInputTablesFromOperationInputTables (mapOperationParams->Input );
354
+ mapTaskParams.Output = TaskOutputTablesFromOperationOutputTables (mapOperationParams->Output );
355
+ mapTaskParams.Executable = mapOperationParams->Executable ;
356
+ return mapTaskParams;
357
+ } else {
358
+ ythrow yexception () << " Unknown operation params" ;
335
359
}
336
360
}
337
361
0 commit comments