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