| 1444 | // ---------------------------------------------------------------------- |
| 1445 | |
| 1446 | Status GetSchema(const void* opaque_schema, DictionaryMemo* dictionary_memo, |
| 1447 | std::shared_ptr<Schema>* out) { |
| 1448 | auto schema = static_cast<const flatbuf::Schema*>(opaque_schema); |
| 1449 | CHECK_FLATBUFFERS_NOT_NULL(schema, "schema"); |
| 1450 | CHECK_FLATBUFFERS_NOT_NULL(schema->fields(), "Schema.fields"); |
| 1451 | int num_fields = static_cast<int>(schema->fields()->size()); |
| 1452 | |
| 1453 | FieldPosition field_pos; |
| 1454 | |
| 1455 | std::vector<std::shared_ptr<Field>> fields(num_fields); |
| 1456 | for (int i = 0; i < num_fields; ++i) { |
| 1457 | const flatbuf::Field* field = schema->fields()->Get(i); |
| 1458 | // XXX I don't think this check is necessary (AP) |
| 1459 | CHECK_FLATBUFFERS_NOT_NULL(field, "DictionaryEncoding.indexType"); |
| 1460 | RETURN_NOT_OK( |
| 1461 | FieldFromFlatbuffer(field, field_pos.child(i), dictionary_memo, &fields[i])); |
| 1462 | } |
| 1463 | |
| 1464 | std::shared_ptr<KeyValueMetadata> metadata; |
| 1465 | RETURN_NOT_OK(internal::GetKeyValueMetadata(schema->custom_metadata(), &metadata)); |
| 1466 | // set endianness using the value in flatbuf schema |
| 1467 | auto endianness = schema->endianness() == flatbuf::Endianness::Endianness_Little |
| 1468 | ? Endianness::Little |
| 1469 | : Endianness::Big; |
| 1470 | *out = ::arrow::schema(std::move(fields), endianness, metadata); |
| 1471 | return Status::OK(); |
| 1472 | } |
| 1473 | |
| 1474 | Status GetTensorMetadata(const Buffer& metadata, std::shared_ptr<DataType>* type, |
| 1475 | std::vector<int64_t>* shape, std::vector<int64_t>* strides, |
no test coverage detected