You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "mapleFU (via GitHub)" <gi...@apache.org> on 2023/08/30 15:52:25 UTC
[GitHub] [arrow] mapleFU commented on a diff in pull request #37471: GH-37466: [C++][Parquet] Fix Valgrind failure in DELTA_BYTE_ARRAY decoder
mapleFU commented on code in PR #37471:
URL: https://github.com/apache/arrow/pull/37471#discussion_r1310490219
##########
cpp/src/parquet/encoding.cc:
##########
@@ -2522,32 +2522,37 @@ class DeltaBitPackDecoder : public DecoderImpl, virtual public TypedDecoder<DTyp
}
int i = 0;
+
+ if (ARROW_PREDICT_FALSE(!first_block_initialized_)) {
+ // This is the first time we decode this data page, first output the
+ // last value and initialize the first block.
+ buffer[i++] = last_value_;
+ if (ARROW_PREDICT_FALSE(i == max_values)) {
+ // When i reaches max_values here we have two different possibilities:
+ // 1. total_value_count_ == 1, which means that the page may have only
+ // one value (encoded in the header), and we should not initialize
+ // any block, nor should we skip any padding bits below.
+ // 2. total_value_count_ != 1, which means we should initialize the
+ // incoming block for subsequent reads.
+ if (total_value_count_ != 1) {
+ InitBlock();
+ }
+ total_values_remaining_ -= max_values;
+ this->num_values_ -= max_values;
+ return max_values;
+ }
+ InitBlock();
+ }
+
+ DCHECK(first_block_initialized_);
while (i < max_values) {
+ // Ensure we have an initialized mini-block
Review Comment:
comment should before 2547?
By the way, is this related to the valgrind error?
--
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