| 451 | Schema* dataset_schema; |
| 452 | |
| 453 | static std::unique_ptr<BasicFragmentEvolution> Make( |
| 454 | const std::shared_ptr<Schema>& dataset_schema, |
| 455 | const std::vector<std::string>& fragment_column_names) { |
| 456 | std::vector<int> ds_to_frag_map; |
| 457 | std::unordered_map<std::string, int> column_names_map; |
| 458 | for (size_t i = 0; i < fragment_column_names.size(); i++) { |
| 459 | column_names_map[fragment_column_names[i]] = static_cast<int>(i); |
| 460 | } |
| 461 | for (int idx = 0; idx < dataset_schema->num_fields(); idx++) { |
| 462 | const std::string& field_name = dataset_schema->field(idx)->name(); |
| 463 | auto column_idx_itr = column_names_map.find(field_name); |
| 464 | if (column_idx_itr == column_names_map.end()) { |
| 465 | ds_to_frag_map.push_back(-1); |
| 466 | } else { |
| 467 | ds_to_frag_map.push_back(column_idx_itr->second); |
| 468 | } |
| 469 | } |
| 470 | return std::make_unique<BasicFragmentEvolution>(std::move(ds_to_frag_map), |
| 471 | dataset_schema.get()); |
| 472 | } |
| 473 | }; |
| 474 | |
| 475 | class BasicDatasetEvolutionStrategy : public DatasetEvolutionStrategy { |