Skip to content

Commit

Permalink
Apply review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jun 29, 2023
1 parent c94dbed commit 3172ba8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions cpp/src/arrow/ipc/reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1018,8 +1018,9 @@ class RecordBatchStreamReaderImpl : public RecordBatchStreamReader,
}

Result<RecordBatchWithMetadata> ReadNext() override {
auto collect_listener = static_cast<CollectListener*>(raw_listener());
while (collect_listener->num_record_batches() == 0) {
auto collect_listener = checked_cast<CollectListener*>(raw_listener());
while (collect_listener->num_record_batches() == 0 &&
state() != StreamDecoderInternal::State::EOS) {
ARROW_ASSIGN_OR_RAISE(auto message, message_reader_->ReadNextMessage());
if (!message) { // End of stream
if (state() == StreamDecoderInternal::State::INITIAL_DICTIONARIES) {
Expand Down
8 changes: 5 additions & 3 deletions cpp/src/arrow/ipc/reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,15 +313,17 @@ class ARROW_EXPORT CollectListener : public Listener {
std::shared_ptr<Schema> schema() const { return schema_; }

/// \return the all decoded record batches
std::vector<std::shared_ptr<RecordBatch>> record_batches() const {
const std::vector<std::shared_ptr<RecordBatch>>& record_batches() const {
return record_batches_;
}

/// \return the all decoded metadatas
std::vector<std::shared_ptr<KeyValueMetadata>> metadatas() const { return metadatas_; }
const 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(); }
int64_t num_record_batches() const { return record_batches_.size(); }

/// \return the last decoded record batch and remove it from
/// record_batches
Expand Down

0 comments on commit 3172ba8

Please sign in to comment.