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

Function ReadRecordBatchInternal

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected