GH-50237: [C++] Migrate arrow/ipc/metadata_internal.h to Result<T>#50245
Conversation
|
Thanks for opening a pull request! If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project. Then could you also rename the pull request title in the following format? or See also: |
Reranko05
left a comment
There was a problem hiding this comment.
I can see some formatting issues in the diff. Could you run: python -m pre_commit run clang-format --files <modified_files> locally and push the resulting changes?
37a27d6 to
a0a6cce
Compare
|
@Reranko05 formatting fixed |
pitrou
left a comment
There was a problem hiding this comment.
Thanks @Shally-Katariya ! This is looking mostly good, just one suggestion below.
| @@ -103,8 +103,8 @@ class Message::MessageImpl { | |||
| if (message_->custom_metadata() != nullptr) { | |||
| // Deserialize from Flatbuffers if first time called | |||
| std::shared_ptr<KeyValueMetadata> md; | |||
There was a problem hiding this comment.
This declaration is unused now, right? Let's just remove it?
a0a6cce to
e4bcb83
Compare
pitrou
left a comment
There was a problem hiding this comment.
+1, thank you @Shally-Katariya . Let's wait for CI.
Rationale for this change
Many APIs in
arrow/ipc/metadata_internal.hused aT* outparameterfor output and returned a
Status. This migrates those APIs to returnResult<T>instead, which is the modern Arrow C++ convention.What changes are included in this PR?
Migrated the following functions from
Status+ output parameter patternto
Result<T>:GetKeyValueMetadataWriteSchemaMessageWriteRecordBatchMessageWriteDictionaryMessageUpdated all call sites in:
arrow/ipc/metadata_internal.ccarrow/ipc/reader.ccarrow/ipc/message.ccarrow/ipc/writer.ccarrow/ipc/message_internal_test.ccarrow/ipc/read_write_test.ccAre these changes tested?
Yes. All existing IPC tests pass:
arrow-ipc-message-internal-test: 8/8 passedarrow-ipc-read-write-test: 409/410 passed (1 pre-existingfailure due to missing
ARROW_TEST_DATA)Are there any user-facing changes?
No. These are internal APIs so no compatibility changes are needed.
Closes #50237
arrow/ipc/metadata_internal.htoResult<T>#50237