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

Function SubstraitFromJSON

cpp/src/arrow/engine/substrait/serde.cc:421–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419}
420
421Result<std::shared_ptr<Buffer>> SubstraitFromJSON(std::string_view type_name,
422 std::string_view json,
423 bool ignore_unknown_fields) {
424 std::string type_url = "/substrait." + std::string(type_name);
425
426 google::protobuf::io::ArrayInputStream json_stream{json.data(),
427 static_cast<int>(json.size())};
428
429 std::string out;
430 google::protobuf::io::StringOutputStream out_stream{&out};
431 google::protobuf::util::JsonParseOptions json_opts;
432 json_opts.ignore_unknown_fields = ignore_unknown_fields;
433 auto status = google::protobuf::util::JsonToBinaryStream(
434 GetGeneratedTypeResolver(), type_url, &json_stream, &out_stream,
435 std::move(json_opts));
436
437 if (!status.ok()) {
438 return Status::Invalid("JsonToBinaryStream returned ", status);
439 }
440 return Buffer::FromString(std::move(out));
441}
442
443Result<std::string> SubstraitToJSON(std::string_view type_name, const Buffer& buf) {
444 std::string type_url = "/substrait." + std::string(type_name);

Callers 5

ASSERT_OK_AND_ASSIGNFunction · 0.85
TESTFunction · 0.85
SerializeJsonPlanFunction · 0.85
GetSubstraitFromServerFunction · 0.85

Calls 6

GetGeneratedTypeResolverFunction · 0.85
FromStringFunction · 0.85
InvalidFunction · 0.50
dataMethod · 0.45
sizeMethod · 0.45
okMethod · 0.45

Tested by 2

ASSERT_OK_AND_ASSIGNFunction · 0.68
TESTFunction · 0.68