| 1530 | } |
| 1531 | |
| 1532 | Status Visit(const Expression& expr) { |
| 1533 | if (auto lit = expr.literal()) { |
| 1534 | if (!lit->is_scalar()) { |
| 1535 | return Status::NotImplemented("Serialization of non-scalar literals"); |
| 1536 | } |
| 1537 | ARROW_ASSIGN_OR_RAISE(auto value, AddScalar(*lit->scalar())); |
| 1538 | metadata_->Append("literal", std::move(value)); |
| 1539 | return Status::OK(); |
| 1540 | } |
| 1541 | |
| 1542 | if (auto ref = expr.field_ref()) { |
| 1543 | return VisitFieldRef(*ref); |
| 1544 | } |
| 1545 | |
| 1546 | auto call = CallNotNull(expr); |
| 1547 | metadata_->Append("call", call->function_name); |
| 1548 | |
| 1549 | for (const auto& argument : call->arguments) { |
| 1550 | RETURN_NOT_OK(Visit(argument)); |
| 1551 | } |
| 1552 | |
| 1553 | if (call->options) { |
| 1554 | ARROW_ASSIGN_OR_RAISE(auto options_scalar, |
| 1555 | internal::FunctionOptionsToStructScalar(*call->options)); |
| 1556 | ARROW_ASSIGN_OR_RAISE(auto value, AddScalar(*options_scalar)); |
| 1557 | metadata_->Append("options", std::move(value)); |
| 1558 | } |
| 1559 | |
| 1560 | metadata_->Append("end", call->function_name); |
| 1561 | return Status::OK(); |
| 1562 | } |
| 1563 | |
| 1564 | Result<std::shared_ptr<RecordBatch>> operator()(const Expression& expr) { |
| 1565 | RETURN_NOT_OK(Visit(expr)); |
no test coverage detected