kou commented on code in PR #36344:
URL: https://github.com/apache/arrow/pull/36344#discussion_r1246016604
##########
cpp/src/arrow/ipc/reader.h:
##########
@@ -301,9 +317,39 @@ class ARROW_EXPORT CollectListener : public Listener {
return record_batches_;
}
+ /// \return the all decoded metadatas
+ std::vector<std::shared_ptr<KeyValueMetadata>> metadatas() const { return
metadatas_; }
+
+ /// \return the number of collected record batches
+ size_t num_record_batches() const { return record_batches_.size(); }
+
+ /// \return the last decoded record batch and remove it from
+ /// record_batches
+ std::shared_ptr<RecordBatch> PopRecordBatch() {
+ auto record_batch_with_metadata = PopRecordBatchWithMetadata();
+ return std::move(record_batch_with_metadata.batch);
+ }
+
+ /// \return the last decoded record batch with custom metadata and
+ /// remove it from record_batches
+ RecordBatchWithMetadata PopRecordBatchWithMetadata() {
+ RecordBatchWithMetadata record_batch_with_metadata;
+ if (record_batches_.empty()) {
+ return record_batch_with_metadata;
+ }
+ record_batch_with_metadata.batch =
+ std::move(record_batches_[record_batches_.size() - 1]);
+ record_batch_with_metadata.custom_metadata =
+ std::move(metadatas_[metadatas_.size() - 1]);
Review Comment:
Thanks! It's what I want!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]