emkornfield commented on code in PR #14603:
URL: https://github.com/apache/arrow/pull/14603#discussion_r1020620357
##########
cpp/src/parquet/column_reader.cc:
##########
@@ -386,6 +395,28 @@ std::shared_ptr<Page> SerializedPageReader::NextPage() {
throw ParquetException("Invalid page header");
}
+ const PageType::type page_type = LoadEnumSafe(¤t_page_header_.type);
+ const bool is_data_page =
+ page_type == PageType::DATA_PAGE || page_type ==
PageType::DATA_PAGE_V2;
+
+ // Once we have the header, we will call the skip_page_call_back_ to
+ // determine if we should be skipping this page. If yes, we will advance
the
+ // stream to the next page.
+ if (skip_page_callback_ && is_data_page) {
+ std::variant<format::DataPageHeader, format::DataPageHeaderV2>
data_page_header;
+ if (page_type == PageType::DATA_PAGE) {
+ data_page_header = current_page_header_.data_page_header;
+ } else {
+ data_page_header = current_page_header_.data_page_header_v2;
+ }
+ std::unique_ptr<DataPageStats> data_page_stats =
+ DataPageStats::Make(&data_page_header);
+ if (skip_page_callback_(data_page_stats.get())) {
+ PARQUET_THROW_NOT_OK(stream_->Advance(compressed_len));
+ return NextPage();
Review Comment:
does it pay to refactor this a little bit so we can use iteration instead of
recursion? (I think it would be good to avoid stack overflow for poorly
constructed files that we filter out most pages for)
--
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]