| 390 | }; |
| 391 | |
| 392 | Result<compute::Expression> DevolveFilter( |
| 393 | const compute::Expression& filter) const override { |
| 394 | return compute::ModifyExpression( |
| 395 | filter, |
| 396 | [&](compute::Expression expr) -> Result<compute::Expression> { |
| 397 | const FieldRef* ref = expr.field_ref(); |
| 398 | if (ref) { |
| 399 | ARROW_ASSIGN_OR_RAISE(FieldPath path, ref->FindOne(*dataset_schema)); |
| 400 | int top_level_idx = path[0]; |
| 401 | std::vector<int> modified_indices(path.indices()); |
| 402 | modified_indices[0] = ds_to_frag_map[top_level_idx]; |
| 403 | if (modified_indices[0] < 0) { |
| 404 | return Status::Invalid( |
| 405 | "Filter cannot be applied. It refers to a missing field ", |
| 406 | ref->ToString(), |
| 407 | " in a way that cannot be satisfied even though we know that field is " |
| 408 | "null filter=", |
| 409 | filter.ToString()); |
| 410 | } |
| 411 | return compute::field_ref(FieldRef(std::move(modified_indices))); |
| 412 | } |
| 413 | return expr; |
| 414 | }, |
| 415 | [](compute::Expression expr, compute::Expression* old_expr) { return expr; }); |
| 416 | }; |
| 417 | |
| 418 | Result<compute::ExecBatch> EvolveBatch( |
| 419 | const std::shared_ptr<RecordBatch>& batch, |