mapleFU commented on code in PR #49296:
URL: https://github.com/apache/arrow/pull/49296#discussion_r2845409505


##########
cpp/src/parquet/decoder.cc:
##########
@@ -1618,16 +1618,27 @@ class DeltaBitPackDecoder : public 
TypedDecoderImpl<DType> {
 
       int values_decode = std::min(values_remaining_current_mini_block_,
                                    static_cast<uint32_t>(max_values - i));
-      if (decoder_->GetBatch(delta_bit_width_, buffer + i, values_decode) !=
-          values_decode) {
-        ParquetException::EofException();
-      }
-      for (int j = 0; j < values_decode; ++j) {
-        // Addition between min_delta, packed int and last_value should be 
treated as
-        // unsigned addition. Overflow is as expected.
-        buffer[i + j] = static_cast<UT>(min_delta_) + static_cast<UT>(buffer[i 
+ j]) +
-                        static_cast<UT>(last_value_);
-        last_value_ = buffer[i + j];
+      if (delta_bit_width_ == 0) {
+        // Fast path that avoids a back-to-back dependency between two 
consecutive
+        // computations: we know all deltas decode to zero. We actually don't
+        // even need to decode them.

Review Comment:
   And also not need to advance decoder? It's a little bit confusing when 
reading but it's right



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