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

Method GetSchema

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

Source from the content-addressed store, hash-verified

79 int64_t EstimatedDataBytes(int) override { return block_size_; }
80
81 static Result<std::shared_ptr<Schema>> GetSchema(
82 const FragmentScanRequest& scan_request, const JsonInspectedFragment& inspected) {
83 FieldVector fields;
84 fields.reserve(inspected.column_names.size());
85 std::unordered_set<int> indices;
86 indices.reserve(inspected.column_names.size());
87
88 for (const auto& scan_column : scan_request.fragment_selection->columns()) {
89 const auto index = scan_column.path[0];
90
91 if (!indices.emplace(index).second) continue;
92
93 const auto& name = inspected.column_names.at(index);
94 auto type = scan_column.requested_type->GetSharedPtr();
95 fields.push_back(field((name), std::move(type)));
96 }
97
98 return schema(std::move(fields));
99 }
100
101 static Future<std::shared_ptr<FragmentScanner>> Make(
102 const FragmentScanRequest& scan_request,

Callers 2

InspectMethod · 0.45

Calls 6

columnsMethod · 0.80
push_backMethod · 0.80
fieldFunction · 0.50
schemaFunction · 0.50
reserveMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected