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

Method AppendValue

cpp/src/arrow/json/from_string.cc:626–651  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

624 }
625
626 Status AppendValue(const rj::Value& json_obj) override {
627 if (json_obj.IsNull()) {
628 return this->AppendNull();
629 }
630 RETURN_NOT_OK(builder_->Append());
631 if (!json_obj.IsArray()) {
632 return JSONTypeError("array", json_obj.GetType());
633 }
634 auto size = json_obj.Size();
635 for (uint32_t i = 0; i < size; ++i) {
636 const auto& json_pair = json_obj[i];
637 if (!json_pair.IsArray()) {
638 return JSONTypeError("array", json_pair.GetType());
639 }
640 if (json_pair.Size() != 2) {
641 return Status::Invalid("key item pair must have exactly two elements, had ",
642 json_pair.Size());
643 }
644 if (json_pair[0].IsNull()) {
645 return Status::Invalid("null key is invalid");
646 }
647 RETURN_NOT_OK(key_converter_->AppendValue(json_pair[0]));
648 RETURN_NOT_OK(item_converter_->AppendValue(json_pair[1]));
649 }
650 return Status::OK();
651 }
652
653 std::shared_ptr<ArrayBuilder> builder() override { return builder_; }
654

Callers 4

AppendValuesMethod · 0.45
AppendValueMethod · 0.45
AppendValueMethod · 0.45
ScalarFromJSONStringFunction · 0.45

Calls 8

JSONTypeErrorFunction · 0.85
OKFunction · 0.70
InvalidFunction · 0.50
IsNullMethod · 0.45
AppendNullMethod · 0.45
AppendMethod · 0.45
GetTypeMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected