| 787 | } |
| 788 | |
| 789 | Result<RecordBatchWithMetadata> ReadRecordBatchInternal( |
| 790 | const Buffer& metadata, const std::shared_ptr<Schema>& schema, |
| 791 | const std::vector<bool>& inclusion_mask, IpcReadContext& context, |
| 792 | io::RandomAccessFile* file) { |
| 793 | const flatbuf::Message* message = nullptr; |
| 794 | RETURN_NOT_OK(internal::VerifyMessage(metadata.data(), metadata.size(), &message)); |
| 795 | auto batch = message->header_as_RecordBatch(); |
| 796 | if (batch == nullptr) { |
| 797 | return Status::IOError( |
| 798 | "Header-type of flatbuffer-encoded Message is not RecordBatch."); |
| 799 | } |
| 800 | |
| 801 | Compression::type compression; |
| 802 | RETURN_NOT_OK(GetCompression(batch, &compression)); |
| 803 | if (context.compression == Compression::UNCOMPRESSED && |
| 804 | message->version() == flatbuf::MetadataVersion::MetadataVersion_V4) { |
| 805 | // Possibly obtain codec information from experimental serialization format |
| 806 | // in 0.17.x |
| 807 | RETURN_NOT_OK(GetCompressionExperimental(message, &compression)); |
| 808 | } |
| 809 | context.compression = compression; |
| 810 | context.metadata_version = internal::GetMetadataVersion(message->version()); |
| 811 | |
| 812 | std::shared_ptr<KeyValueMetadata> custom_metadata; |
| 813 | if (message->custom_metadata() != nullptr) { |
| 814 | ARROW_ASSIGN_OR_RAISE(custom_metadata, |
| 815 | internal::GetKeyValueMetadata(message->custom_metadata())); |
| 816 | } |
| 817 | ARROW_ASSIGN_OR_RAISE(auto record_batch, |
| 818 | LoadRecordBatch(batch, schema, inclusion_mask, context, file)); |
| 819 | return RecordBatchWithMetadata{record_batch, custom_metadata}; |
| 820 | } |
| 821 | |
| 822 | // If we are selecting only certain fields, populate an inclusion mask for fast lookups. |
| 823 | // Additionally, drop deselected fields from the reader's schema. |
nothing calls this directly
no test coverage detected