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

Function DoInspectFragment

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

Source from the content-addressed store, hash-verified

333}
334
335Result<std::shared_ptr<InspectedFragment>> DoInspectFragment(
336 const FileSource& source, const JsonFragmentScanOptions& format_options,
337 MemoryPool* pool) {
338 ARROW_ASSIGN_OR_RAISE(auto stream, source.OpenCompressed());
339 ARROW_ASSIGN_OR_RAISE(
340 stream, io::BufferedInputStream::Create(format_options.read_options.block_size,
341 default_memory_pool(), std::move(stream)));
342
343 ARROW_ASSIGN_OR_RAISE(auto first_block,
344 stream->Peek(format_options.read_options.block_size));
345
346 auto parse_options = GetInitialParseOptions(format_options.parse_options);
347 ARROW_ASSIGN_OR_RAISE(auto struct_type,
348 ParseToStructType(first_block, parse_options, pool));
349
350 std::vector<std::string> column_names;
351 column_names.reserve(struct_type->num_fields());
352 for (const auto& f : struct_type->fields()) {
353 column_names.push_back(f->name());
354 }
355
356 return std::make_shared<JsonInspectedFragment>(std::move(column_names),
357 std::move(stream), source.Size());
358}
359
360} // namespace
361

Callers 1

InspectFragmentMethod · 0.70

Calls 9

default_memory_poolFunction · 0.85
GetInitialParseOptionsFunction · 0.85
push_backMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.50
reserveMethod · 0.45
num_fieldsMethod · 0.45
fieldsMethod · 0.45
nameMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected