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

Function ReadRecordBatchInternal

cpp/src/arrow/ipc/reader.cc:789–820  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

787}
788
789Result<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.

Callers

nothing calls this directly

Calls 11

VerifyMessageFunction · 0.85
IOErrorFunction · 0.85
GetCompressionFunction · 0.85
GetMetadataVersionFunction · 0.85
GetKeyValueMetadataFunction · 0.85
ARROW_ASSIGN_OR_RAISEFunction · 0.70
dataMethod · 0.45
sizeMethod · 0.45
versionMethod · 0.45
custom_metadataMethod · 0.45

Tested by

no test coverage detected