| 366 | } |
| 367 | |
| 368 | Result<std::unique_ptr<FragmentSelection>> DevolveSelection( |
| 369 | const std::vector<FieldPath>& dataset_schema_selection) const override { |
| 370 | std::vector<FragmentSelectionColumn> desired_columns; |
| 371 | std::vector<MissingColumn> missing_columns; |
| 372 | for (std::size_t selection_idx = 0; selection_idx < dataset_schema_selection.size(); |
| 373 | selection_idx++) { |
| 374 | const FieldPath& path = dataset_schema_selection[selection_idx]; |
| 375 | ARROW_ASSIGN_OR_RAISE(std::shared_ptr<Field> field, path.Get(*dataset_schema)); |
| 376 | int top_level_field_idx = path[0]; |
| 377 | int dest_top_level_idx = ds_to_frag_map[top_level_field_idx]; |
| 378 | if (dest_top_level_idx >= 0) { |
| 379 | ARROW_ASSIGN_OR_RAISE(std::shared_ptr<Field> field, path.Get(*dataset_schema)); |
| 380 | std::vector<int> dest_path_indices(path.indices()); |
| 381 | dest_path_indices[0] = dest_top_level_idx; |
| 382 | desired_columns.push_back( |
| 383 | FragmentSelectionColumn{FieldPath(dest_path_indices), field->type().get()}); |
| 384 | } else { |
| 385 | missing_columns.push_back({selection_idx, field->type()}); |
| 386 | } |
| 387 | } |
| 388 | return std::make_unique<BasicFragmentSelection>(std::move(desired_columns), |
| 389 | std::move(missing_columns)); |
| 390 | }; |
| 391 | |
| 392 | Result<compute::Expression> DevolveFilter( |
| 393 | const compute::Expression& filter) const override { |