mapleFU commented on issue #15173:
URL: https://github.com/apache/arrow/issues/15173#issuecomment-1385858560

   Hi pitrou, I've reproduce it in `examples`, you can take a look at 
https://github.com/mapleFU/arrow/tree/parquet/fix-decode-bug and this commit: 
https://github.com/mapleFU/arrow/commit/655cd2a2ea3acee6bdc1d14bd87a2ec87411f108
   @pitrou 
   I think I can use the code below to fix it:
   
   ```c++
     // Get a decoder object for this page or create a new decoder if this is 
the
     // first page with this encoding.
     void InitializeDataDecoder(const DataPage& page, int64_t levels_byte_size) 
{
       auto it = decoders_.find(static_cast<int>(encoding));
       if (it != decoders_.end()) {
         DCHECK(it->second.get() != nullptr);
         current_decoder_ = it->second.get();
       } else {
         switch (encoding) {
          ...
           case Encoding::DELTA_LENGTH_BYTE_ARRAY: {
             auto decoder =
                 MakeTypedDecoder<DType>(Encoding::DELTA_LENGTH_BYTE_ARRAY, 
descr_);
             current_decoder_ = decoder.get();
             decoders_[static_cast<int>(encoding)] = std::move(decoder);
   +          // recounting buffered values here
             break;
           }
   
           default:
             throw ParquetException("Unknown encoding type.");
         }
       }
       current_encoding_ = encoding;
       current_decoder_->SetData(static_cast<int>(num_buffered_values_), buffer,
                                 static_cast<int>(data_size));
     }
   ```


-- 
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]

Reply via email to