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/06/21 12:22:48 UTC

[GitHub] [arrow] mapleFU commented on a diff in pull request #36183: GH-20505: [C++] Optimize DELTA_BINARY_PACKED encoding

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


##########
cpp/src/parquet/encoding.cc:
##########
@@ -2189,7 +2193,13 @@ void DeltaBitPackEncoder<DType>::Put(const T* src, int num_values) {
     // making subtraction operations well-defined and correct even in case of overflow.
     // Encoded integers will wrap back around on decoding.
     // See http://en.wikipedia.org/wiki/Modular_arithmetic#Integers_modulo_n
-    deltas_[values_current_block_] = value - current_value_;
+    UT delta = value - current_value_;
+    //update blocks minimum delta
+    if(delta < min_delta_) min_delta_ = delta;
+    //calculate which block a maximum delta belongs to -> whole number division
+    const uint32_t miniblock_index{values_current_block_/values_per_mini_block_};
+    if(delta > max_deltas_[miniblock_index])max_deltas_[miniblock_index] = delta;

Review Comment:
   After that `FlushBlock` is called, should `max_deltas_` being set to 0? Seems that previous block's max will be bring into next block?



##########
cpp/src/parquet/encoding.cc:
##########
@@ -2163,6 +2164,8 @@ class DeltaBitPackEncoder : public EncoderImpl, virtual public TypedEncoder<DTyp
   uint32_t total_value_count_{0};
   UT first_value_{0};
   UT current_value_{0};
+  UT min_delta_;

Review Comment:
   should it default as UT::max ?



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