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

Function ReadRecordBatchInternal

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

Source from the content-addressed store, hash-verified

802}
803
804Result<RecordBatchWithMetadata> ReadRecordBatchInternal(
805 const Buffer& metadata, const std::shared_ptr<Schema>& schema,
806 const std::vector<bool>& inclusion_mask, IpcReadContext& context,
807 io::RandomAccessFile* file) {
808 const flatbuf::Message* message = nullptr;
809 RETURN_NOT_OK(internal::VerifyMessage(metadata.data(), metadata.size(), &message));
810 auto batch = message->header_as_RecordBatch();
811 if (batch == nullptr) {
812 return Status::IOError(
813 "Header-type of flatbuffer-encoded Message is not RecordBatch.");
814 }
815
816 Compression::type compression;
817 RETURN_NOT_OK(GetCompression(batch, &compression));
818 if (context.compression == Compression::UNCOMPRESSED &&
819 message->version() == flatbuf::MetadataVersion::MetadataVersion_V4) {
820 // Possibly obtain codec information from experimental serialization format
821 // in 0.17.x
822 RETURN_NOT_OK(GetCompressionExperimental(message, &compression));
823 }
824 context.compression = compression;
825 context.metadata_version = internal::GetMetadataVersion(message->version());
826
827 std::shared_ptr<KeyValueMetadata> custom_metadata;
828 if (message->custom_metadata() != nullptr) {
829 ARROW_ASSIGN_OR_RAISE(custom_metadata,
830 internal::GetKeyValueMetadata(message->custom_metadata()));
831 }
832 ARROW_ASSIGN_OR_RAISE(auto record_batch,
833 LoadRecordBatch(batch, schema, inclusion_mask, context, file));
834 return RecordBatchWithMetadata{record_batch, custom_metadata};
835}
836
837// If we are selecting only certain fields, populate an inclusion mask for fast lookups.
838// 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
ARROW_ASSIGN_OR_RAISEFunction · 0.70
GetKeyValueMetadataFunction · 0.70
dataMethod · 0.45
sizeMethod · 0.45
versionMethod · 0.45
custom_metadataMethod · 0.45

Tested by

no test coverage detected