You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/10/28 19:09:01 UTC
[GitHub] [arrow] fatemehp commented on a diff in pull request #14545: MINOR: [PARQUET] Optimize skip for the case that number of values to skip equals page size
fatemehp commented on code in PR #14545:
URL: https://github.com/apache/arrow/pull/14545#discussion_r1008368346
##########
cpp/src/parquet/column_reader.cc:
##########
@@ -1141,12 +1146,14 @@ int64_t TypedColumnReaderImpl<DType>::ReadBatchSpaced(
template <typename DType>
int64_t TypedColumnReaderImpl<DType>::Skip(int64_t num_values_to_skip) {
int64_t values_to_skip = num_values_to_skip;
- while (HasNext() && values_to_skip > 0) {
+ // Optimization: Do not call HasNext() when values_to_skip == 0.
+ while (values_to_skip > 0 && HasNext()) {
// If the number of values to skip is more than the number of undecoded values, skip
// the Page.
- if (values_to_skip > (this->num_buffered_values_ - this->num_decoded_values_)) {
- values_to_skip -= this->num_buffered_values_ - this->num_decoded_values_;
- this->num_decoded_values_ = this->num_buffered_values_;
+ const int64_t available_values = this->available_values_current_page();
+ if (values_to_skip >= available_values) {
Review Comment:
This line has the main change for this request.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org