imay commented on a change in pull request #2630: Support bitmap index for more 
type
URL: https://github.com/apache/incubator-doris/pull/2630#discussion_r365139563
 
 

 ##########
 File path: be/src/util/frame_of_reference_coding.cpp
 ##########
 @@ -109,13 +131,20 @@ void ForEncoder<T>::bit_packing_one_frame_value(const T* 
input) {
     T max = input[0];
     bool is_ascending = true;
     uint8_t bit_width = 0;
+    T half_max_delta = numeric_limits_max() >> 1;
+    bool save_original_value = false;
 
+    // 1. make sure order_flag, save_original_value, and find max&min.
     for (uint8_t i = 1; i < _buffered_values_num; ++i) {
         if (is_ascending) {
             if (input[i] < input[i - 1]) {
                 is_ascending = false;
             } else {
-                bit_width = std::max(bit_width, bits(input[i]- input[i - 1])) ;
+                if ((input[i] >> 1) - (input[i - 1] >> 1) > half_max_delta) { 
// overflow
+                    save_original_value = true;
 
 Review comment:
   1. seems can break this loop?
   2. if don't break this loop, this can be done after loop with min and 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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to