lidavidm commented on code in PR #12812:
URL: https://github.com/apache/arrow/pull/12812#discussion_r852110810
##########
cpp/src/arrow/ipc/reader.h:
##########
@@ -190,6 +190,15 @@ class ARROW_EXPORT RecordBatchFileReader
/// \return the read batch
virtual Result<std::shared_ptr<RecordBatch>> ReadRecordBatch(int i) = 0;
+ /// \brief Read a particular record batch along with its custom metadatda
from the file.
Review Comment:
```suggestion
/// \brief Read a particular record batch along with its custom metadada
from the file.
```
##########
cpp/src/arrow/ipc/reader.cc:
##########
@@ -875,15 +894,31 @@ class RecordBatchStreamReaderImpl : public
RecordBatchStreamReader {
if (message == nullptr) {
// End of stream
*batch = nullptr;
+ if (custom_metadata != nullptr) {
+ *custom_metadata = nullptr;
+ }
return Status::OK();
}
CHECK_HAS_BODY(*message);
ARROW_ASSIGN_OR_RAISE(auto reader, Buffer::GetReader(message->body()));
IpcReadContext context(&dictionary_memo_, options_, swap_endian_);
- return ReadRecordBatchInternal(*message->metadata(), schema_,
field_inclusion_mask_,
- context, reader.get())
- .Value(batch);
+ auto result = ReadRecordBatchInternal(*message->metadata(), schema_,
+ field_inclusion_mask_, context,
reader.get());
+ if (result.ok()) {
+ auto batch_and_metadata = result.ValueOrDie();
Review Comment:
you can `std::move(result).ValueUnsafe()`
##########
cpp/src/arrow/record_batch.h:
##########
@@ -227,6 +227,11 @@ class ARROW_EXPORT RecordBatchReader {
/// \return Status
virtual Status ReadNext(std::shared_ptr<RecordBatch>* batch) = 0;
+ virtual Status ReadNext(std::shared_ptr<RecordBatch>* batch,
+ std::shared_ptr<KeyValueMetadata>* custom_metadata) {
+ return Status::NotImplemented("ReadNext with custom metadata");
+ }
Review Comment:
Hmm, should we prefer `arrow::Result` for new APIs?
--
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]