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

Function FieldIdFromMetadata

cpp/src/parquet/arrow/schema.cc:292–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290}
291
292int FieldIdFromMetadata(
293 const std::shared_ptr<const ::arrow::KeyValueMetadata>& metadata) {
294 if (!metadata) {
295 return -1;
296 }
297 int key = metadata->FindKey(FIELD_ID_KEY);
298 if (key < 0) {
299 return -1;
300 }
301 std::string field_id_str = metadata->value(key);
302 int field_id;
303 if (::arrow::internal::ParseValue<::arrow::Int32Type>(
304 field_id_str.c_str(), field_id_str.length(), &field_id)) {
305 if (field_id < 0) {
306 // Thrift should convert any negative value to null but normalize to -1 here in
307 // case we later check this in logic.
308 return -1;
309 }
310 return field_id;
311 } else {
312 return -1;
313 }
314}
315
316Status FieldToNode(const std::string& name, const std::shared_ptr<Field>& field,
317 const WriterProperties& properties,

Callers 1

FieldToNodeFunction · 0.85

Calls 3

FindKeyMethod · 0.80
valueMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected