Skip to content

GH-50237: [C++] Migrate arrow/ipc/metadata_internal.h to Result<T>#50245

Merged
pitrou merged 1 commit into
apache:mainfrom
Shally-Katariya:migrate-metadata-internal-result
Jun 25, 2026
Merged

GH-50237: [C++] Migrate arrow/ipc/metadata_internal.h to Result<T>#50245
pitrou merged 1 commit into
apache:mainfrom
Shally-Katariya:migrate-metadata-internal-result

Conversation

@Shally-Katariya

@Shally-Katariya Shally-Katariya commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

Many APIs in arrow/ipc/metadata_internal.h used a T* out parameter
for output and returned a Status. This migrates those APIs to return
Result<T> instead, which is the modern Arrow C++ convention.

What changes are included in this PR?

Migrated the following functions from Status + output parameter pattern
to Result<T>:

  • GetKeyValueMetadata
  • WriteSchemaMessage
  • WriteRecordBatchMessage
  • WriteDictionaryMessage

Updated all call sites in:

  • arrow/ipc/metadata_internal.cc
  • arrow/ipc/reader.cc
  • arrow/ipc/message.cc
  • arrow/ipc/writer.cc
  • arrow/ipc/message_internal_test.cc
  • arrow/ipc/read_write_test.cc

Are these changes tested?

Yes. All existing IPC tests pass:

  • arrow-ipc-message-internal-test: 8/8 passed
  • arrow-ipc-read-write-test: 409/410 passed (1 pre-existing
    failure 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

@Shally-Katariya Shally-Katariya requested a review from pitrou as a code owner June 24, 2026 14:19
@github-actions

Copy link
Copy Markdown

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?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

See also:

@Reranko05 Reranko05 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@Shally-Katariya Shally-Katariya force-pushed the migrate-metadata-internal-result branch from 37a27d6 to a0a6cce Compare June 24, 2026 14:53
@Shally-Katariya

Copy link
Copy Markdown
Contributor Author

@Reranko05 formatting fixed

@pitrou pitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Shally-Katariya ! This is looking mostly good, just one suggestion below.

Comment thread cpp/src/arrow/ipc/message.cc Outdated
@@ -103,8 +103,8 @@ class Message::MessageImpl {
if (message_->custom_metadata() != nullptr) {
// Deserialize from Flatbuffers if first time called
std::shared_ptr<KeyValueMetadata> md;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This declaration is unused now, right? Let's just remove it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@github-actions github-actions Bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jun 25, 2026
@Shally-Katariya Shally-Katariya force-pushed the migrate-metadata-internal-result branch from a0a6cce to e4bcb83 Compare June 25, 2026 09:09

@pitrou pitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, thank you @Shally-Katariya . Let's wait for CI.

@pitrou pitrou changed the title [C++] Migrate arrow/ipc/metadata_internal.h to Result<T> GH-50237: [C++] Migrate arrow/ipc/metadata_internal.h to Result<T> Jun 25, 2026
@pitrou pitrou merged commit b69ba75 into apache:main Jun 25, 2026
55 of 57 checks passed
@pitrou pitrou removed the awaiting committer review Awaiting committer review label Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C++] Migrate arrow/ipc/metadata_internal.h to Result<T>

3 participants