| 136 | } |
| 137 | |
| 138 | Result<std::shared_ptr<StructType>> ParseToStructType( |
| 139 | std::string_view data, const json::ParseOptions& parse_options, MemoryPool* pool) { |
| 140 | auto full_buffer = std::make_shared<Buffer>(data); |
| 141 | std::shared_ptr<Buffer> buffer, partial; |
| 142 | auto chunker = json::MakeChunker(parse_options); |
| 143 | RETURN_NOT_OK(chunker->Process(full_buffer, &buffer, &partial)); |
| 144 | |
| 145 | std::unique_ptr<json::BlockParser> parser; |
| 146 | RETURN_NOT_OK(json::BlockParser::Make(pool, parse_options, &parser)); |
| 147 | RETURN_NOT_OK(parser->Parse(buffer)); |
| 148 | std::shared_ptr<Array> parsed; |
| 149 | RETURN_NOT_OK(parser->Finish(&parsed)); |
| 150 | |
| 151 | return checked_pointer_cast<StructType>(parsed->type()); |
| 152 | } |
| 153 | |
| 154 | Result<std::shared_ptr<Schema>> ParseToSchema(std::string_view data, |
| 155 | const json::ParseOptions& parse_options, |