Skip to content

Commit 846e6b4

Browse files
author
Nong Li
committed
Fix max encoded size estimate in RLE encoding.
1 parent 46f5b52 commit 846e6b4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/impala/rle-encoding.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ class RleEncoder {
144144
int bytes_per_run = BitUtil::Ceil(bit_width * MAX_VALUES_PER_LITERAL_RUN, 8.0);
145145
int num_runs = BitUtil::Ceil(num_values, MAX_VALUES_PER_LITERAL_RUN);
146146
int literal_max_size = num_runs + num_runs * bytes_per_run;
147-
return std::max(MinBufferSize(bit_width), literal_max_size);
147+
int min_run_size = MinBufferSize(bit_width);
148+
return std::max(min_run_size, literal_max_size) + min_run_size;
148149
}
149150

150151
// Encode value. Returns true if the value fits in buffer, false otherwise.

0 commit comments

Comments
 (0)