mapleFU commented on PR #15241:
URL: https://github.com/apache/arrow/pull/15241#issuecomment-1377596076

   Let's go back to the original code:
   
   ```c++
         if (ARROW_PREDICT_FALSE(values_remaining_current_mini_block_ == 0)) {
           if (ARROW_PREDICT_FALSE(!first_block_initialized_)) {
             buffer[i++] = last_value_;
             DCHECK_EQ(i, 1);  // we're at the beginning of the page
             DCHECK_EQ(values_num_up_to_current_mini_block_, 0);
             values_num_up_to_current_mini_block_ = 1;
             if (ARROW_PREDICT_FALSE(i == max_values)) {
               // When block is uninitialized and i reaches max_values 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.
               // 2. total_value_count_ != 1, which means we should initialize 
the
               // incoming block for subsequent reads.
               if (total_value_count_ != 1) {
                 InitBlock();
               }
               break;
             }
             InitBlock();
           }
   ```
   
   And assume the page has 33 values:
   1. `total_value_count_ == 1`, call `InitBlock`
   2. `current_num_values = 0`, read block one, change to 32.
   3. `current_num_values = 32`, read block one, change to 64.
   
   But here, it should be `1` firstly.


-- 
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-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to