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

Function FieldIdFromMetadata

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

Source from the content-addressed store, hash-verified

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