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

Function ParseToStructType

cpp/src/arrow/dataset/file_json.cc:138–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136}
137
138Result<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
154Result<std::shared_ptr<Schema>> ParseToSchema(std::string_view data,
155 const json::ParseOptions& parse_options,

Callers

nothing calls this directly

Calls 6

MakeChunkerFunction · 0.50
MakeFunction · 0.50
ProcessMethod · 0.45
ParseMethod · 0.45
FinishMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected