| 726 | explicit StructConverter(const std::shared_ptr<DataType>& type) { type_ = type; } |
| 727 | |
| 728 | Status Init() override { |
| 729 | std::vector<std::shared_ptr<ArrayBuilder>> child_builders; |
| 730 | for (const auto& field : type_->fields()) { |
| 731 | std::shared_ptr<JSONConverter> child_converter; |
| 732 | RETURN_NOT_OK(GetConverter(field->type(), &child_converter)); |
| 733 | child_converters_.push_back(child_converter); |
| 734 | child_builders.push_back(child_converter->builder()); |
| 735 | } |
| 736 | for (int32_t i = 0; i < type_->num_fields(); ++i) { |
| 737 | field_index_.emplace(type_->field(i)->name(), i); |
| 738 | } |
| 739 | builder_ = std::make_shared<StructBuilder>(type_, default_memory_pool(), |
| 740 | std::move(child_builders)); |
| 741 | return Status::OK(); |
| 742 | } |
| 743 | |
| 744 | // Append a JSON value that is either an array of N elements in order |
| 745 | // or an object mapping struct names to values (omitted struct members |
nothing calls this directly
no test coverage detected