MCPcopy Create free account
hub / github.com/apache/arrow / DevolveFilter

Method DevolveFilter

cpp/src/arrow/dataset/dataset.cc:392–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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,

Callers 2

TESTFunction · 0.80

Calls 7

ModifyExpressionFunction · 0.85
field_refFunction · 0.85
field_refMethod · 0.80
indicesMethod · 0.80
InvalidFunction · 0.50
FieldRefFunction · 0.50
ToStringMethod · 0.45

Tested by 1

TESTFunction · 0.64