| 291 | } |
| 292 | |
| 293 | int 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 | |
| 317 | Status FieldToNode(const std::string& name, const std::shared_ptr<Field>& field, |
| 318 | const WriterProperties& properties, |
no test coverage detected