kou commented on code in PR #39164:
URL: https://github.com/apache/arrow/pull/39164#discussion_r1421772936
##########
cpp/src/arrow/ipc/reader.h:
##########
@@ -317,7 +317,12 @@ class ARROW_EXPORT Listener {
/// \since 0.17.0
class ARROW_EXPORT CollectListener : public Listener {
public:
- CollectListener() : schema_(), filtered_schema_(), record_batches_(),
metadatas_() {}
+ CollectListener(bool copy_record_batch = false)
Review Comment:
I'm not sure this is a good API...
Should we create a new `CopyCollectListener` or something instead?
##########
cpp/src/arrow/ipc/message.cc:
##########
@@ -872,10 +889,10 @@ class MessageDecoder::MessageDecoderImpl {
buffered_size_ -= used_size;
return Status::OK();
} else {
- ARROW_ASSIGN_OR_RAISE(auto body, AllocateBuffer(next_required_size_,
pool_));
+ ARROW_ASSIGN_OR_RAISE(std::shared_ptr<Buffer> body,
+ AllocateBuffer(next_required_size_, pool_));
RETURN_NOT_OK(ConsumeDataChunks(next_required_size_,
body->mutable_data()));
- std::shared_ptr<Buffer> shared_body(body.release());
- return ConsumeBody(&shared_body);
+ return ConsumeBody(&body);
Review Comment:
This is just a clean up. This is not related to this fix.
##########
cpp/src/arrow/ipc/reader.cc:
##########
@@ -2052,6 +2052,39 @@ Status Listener::OnRecordBatchWithMetadataDecoded(
return OnRecordBatchDecoded(std::move(record_batch_with_metadata.batch));
}
+namespace {
+Status CopyArrayData(std::shared_ptr<ArrayData> data) {
Review Comment:
Maybe, we should not do this...
##########
cpp/src/arrow/ipc/message.cc:
##########
@@ -830,8 +849,7 @@ class MessageDecoder::MessageDecoderImpl {
}
buffered_size_ -= next_required_size_;
} else {
- ARROW_ASSIGN_OR_RAISE(auto metadata, AllocateBuffer(next_required_size_,
pool_));
- metadata_ = std::shared_ptr<Buffer>(metadata.release());
+ ARROW_ASSIGN_OR_RAISE(metadata_, AllocateBuffer(next_required_size_,
pool_));
Review Comment:
This is just a clean up. This is not related to this fix.
##########
cpp/src/arrow/ipc/message.cc:
##########
@@ -846,9 +864,8 @@ class MessageDecoder::MessageDecoderImpl {
next_required_size_ = skip_body_ ? 0 : body_length;
RETURN_NOT_OK(listener_->OnBody());
if (next_required_size_ == 0) {
- ARROW_ASSIGN_OR_RAISE(auto body, AllocateBuffer(0, pool_));
- std::shared_ptr<Buffer> shared_body(body.release());
- return ConsumeBody(&shared_body);
+ auto body = std::make_shared<Buffer>(nullptr, 0);
+ return ConsumeBody(&body);
Review Comment:
This is just a clean up. This is not related to this fix.
--
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]