-
Notifications
You must be signed in to change notification settings - Fork 4k
GH-48394: [C++][Parquet] Add arrow::Result version of parquet::arrow::FileReader::ReadTable() #48939
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
base: main
Are you sure you want to change the base?
Conversation
|
|
|
Hi @kou, Could you please review it? Thanks! |
| std::shared_ptr<arrow::Table> parquet_table; | ||
| // Read the table. | ||
| PARQUET_THROW_NOT_OK(reader->ReadTable(&parquet_table)); | ||
| PARQUET_ASSIGN_OR_THROW(auto parquet_table, reader->ReadTable()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you keep using explicit type instead of auto for easy to understand?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated.
| auto table_result = reader->ReadTable(column_indices); | ||
| ASSERT_OK(table_result.status()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| auto table_result = reader->ReadTable(column_indices); | |
| ASSERT_OK(table_result.status()); | |
| ASSERT_OK_AND_ASSIGN(auto table, reader->ReadTable(column_indices)); |
If this reports the "variable is not used" warning, we can use ASSERT_OK(reader->ReadTable(column_indices).status());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated.
| std::shared_ptr<Table> result; | ||
| ASSERT_OK(reader->ReadTable(column_subset, &result)); | ||
| ASSERT_OK_AND_ASSIGN(result, reader->ReadTable(column_subset)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use ASSERT_OK_AND_ASSIGN(auto result, reader->ReadTable(column_subset)); here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated.
| std::shared_ptr<Table> result; | ||
| ASSERT_OK_NO_THROW(reader->ReadTable(&result)); | ||
| ASSERT_OK_AND_ASSIGN(result, reader->ReadTable()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto. (There are more similar codes.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated.
| RETURN_NOT_OK(ReadRowGroups(Iota(reader_->metadata()->num_row_groups()), | ||
| column_indices, &table)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh... We need to add arrow::Result version of ReadRowGroups()...
Let's work on it as a separated task. Could you open an issue for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll open a new issue for the ReadRowGroups refactoring. I'll get to the code updates soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
afe13a4 to
cf88ec1
Compare
|
I've created #48949 to track add |
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
|
Hi, @kou, I have a question: For R / Python / GLib bindings, can we switch directly to the new API? |
|
Yes. If you can't do it, I can help it. |
|
Thanks! I’ll try it first. |
cf88ec1 to
6ae9eb5
Compare
|
@kou CI passed, Please take a look when you get a chance. |
Rationale for this change
FileReader::ReadTablepreviously returnedStatusand required callers to pass anoutparameter.What changes are included in this PR?
Introduce
Result<std::shared_ptr<Table>>returning API to allow clearer error propagation:ReadTable()methodsAre these changes tested?
Yes.
Are there any user-facing changes?
Yes.
Status version FileReader::ReadTable has been deprecated.
arrow::Resultversion ofparquet::arrow::FileReader::ReadTable()#48394