Skip to content

GH-46869: [C++][Parquet] Add arrow::Result version of parquet::arrow::FileReader::GetRecordBatchReader() #46932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Ziy1-Tan
Copy link
Contributor

@Ziy1-Tan Ziy1-Tan commented Jun 29, 2025

Rationale for this change

We're migrating arrow::Status + output variable API to arrow::Result API.

What changes are included in this PR?

  • Add arrow::Result<std::shared_ptr<arrow::RecordBatchReader parquet::arrow::FileReader::GetRecordBatchReaderSharedPtr()
  • Deprecate arrow::Status parquet::arrow::FileReadeder::GetRecordBatchReader()
  • Use the added arrow::Result version in our code base

Are these changes tested?

Yes.

Are there any user-facing changes?

Yes.

This PR includes breaking changes to public APIs. GetRecordBatchReader() --> GetRecordBatchReaderSharedPtr(), because overloading is not possible if only the return value is different

@Ziy1-Tan Ziy1-Tan requested a review from wgtmac as a code owner June 29, 2025 08:44
@Ziy1-Tan Ziy1-Tan changed the title GH-46869: [C++][Parquet] Add arrow::Result version of parquet::arrow::FileReader::GetRecordBatchReader() GH-46869: [C++][Parquet] Add arrow::Result version of parquet::arrow::FileReader::GetRecordBatchReader() Jun 29, 2025
@github-actions github-actions bot added the awaiting review Awaiting review label Jun 29, 2025
@wgtmac
Copy link
Member

wgtmac commented Jun 29, 2025

It would be better to change all test cases to use new non-deprecated apis.

@Ziy1-Tan
Copy link
Contributor Author

It would be better to change all test cases to use new non-deprecated apis.

It is only used by example before:

std::shared_ptr<::arrow::RecordBatchReader> rb_reader;
ARROW_ASSIGN_OR_RAISE(rb_reader, arrow_reader->GetRecordBatchReader());

Copy link
Member

@wgtmac wgtmac left a comment

Choose a reason for hiding this comment

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

@@ -191,13 +191,53 @@ class PARQUET_EXPORT FileReader {
///
/// \returns error Status if either row_group_indices or column_indices
/// contains an invalid index
/// \deprecated Deprecated in future release. Use arrow::Result version instead.
ARROW_DEPRECATED("Deprecated in future release. Use arrow::Result version instead.")
Copy link
Member

Choose a reason for hiding this comment

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

Can we specify a clear deprecated version? It should be 21.0.0 for now. (Note that there will be a feature freeze on July 1st)

/// \returns error Result if either row_group_indices or column_indices
/// contains an invalid index
virtual ::arrow::Result<std::shared_ptr<::arrow::RecordBatchReader>>
GetRecordBatchReaderSharedPtr(const std::vector<int>& row_group_indices,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
GetRecordBatchReaderSharedPtr(const std::vector<int>& row_group_indices,
GetRecordBatchReader(const std::vector<int>& row_group_indices,

Can we avoid adding SharedPtr to be consistent?

@github-actions github-actions bot added awaiting committer review Awaiting committer review awaiting review Awaiting review and removed awaiting review Awaiting review labels Jun 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting committer review Awaiting committer review awaiting review Awaiting review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants