Skip to content

Commit b7f654c

Browse files
authored
Better Reserve() on index column of LC
1 parent e57e463 commit b7f654c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clickhouse/columns/lowcardinality.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ void ColumnLowCardinality::Reserve(size_t new_cap) {
180180
// NOTE(vnemkov): Formula below (`ceil(sqrt(x))`) is a gut-feeling-good-enough estimation,
181181
// feel free to replace/adjust if you have better one suported by actual data.
182182
dictionary_column_->Reserve(static_cast<size_t>(ceil(sqrt(new_cap))));
183-
index_column_->Reserve(new_cap);
183+
index_column_->Reserve(new_cap + 2); // + 1 for null item (at pos 0), + 1 for default item (at pos 1)
184184
}
185185

186186
void ColumnLowCardinality::Setup(ColumnRef dictionary_column) {

0 commit comments

Comments
 (0)