Skip to content

Commit 12f0399

Browse files
committed
Lowered estimation max error
1 parent 57a426c commit 12f0399

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

ut/ColumnString_ut.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ size_t EstimateColumnStringMemoryUsage(
4747
? COLUMN_STRING_DEFAULT_BLOCK_SIZE % static_cast<size_t>(static_cast<size_t>(item_estimated_size) * value_to_estimation_average_size_ratio)
4848
: COLUMN_STRING_DEFAULT_BLOCK_SIZE / 10);
4949

50-
const auto max_estimation_error_factor = item_estimated_size == ColumnString::NO_PREALLOCATE ? 2.5 : 2;
50+
const auto max_estimation_error_factor = item_estimated_size == ColumnString::NO_PREALLOCATE ? 2 : 1.2;
5151

5252
return (number_of_items * sizeof(std::string_view)
5353
+ estimated_total_item_size

ut/utils_ut.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,16 @@ TEST_F(OutputTest, PrettyPrintByteSize)
158158
{3.25, "3.25"},
159159
{13.75, "13.75"},
160160
{135.5, "135.5"},
161-
{135.125, "135.125"},
161+
{135.125, "135.12"},
162162
{10, "10"},
163163
{100, "100"},
164164
{1000, "1000"},
165165
})
166166
{
167167
const auto bytes_value = static_cast<size_t>(base * value);
168168
const auto expected_str = std::string(value_str) + " " + base_name;
169-
EXPECT_EQ(expected_str, ToString(PrettyPrintByteSize{bytes_value}))
169+
170+
EXPECT_EQ(expected_str, ToString(PrettyPrintByteSize{bytes_value, 2}))
170171
<< "\n\tbase: " << base
171172
<< "\n\tbase_name: " << base_name
172173
<< "\n\tvalue: " << value

0 commit comments

Comments
 (0)