mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +00:00
Fix half of trash
This commit is contained in:
parent
daff201566
commit
fa62c7e982
@ -22,7 +22,7 @@ POCO_IMPLEMENT_EXCEPTION(JSONException, Poco::Exception, "JSONException") // NOL
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/// Прочитать беззнаковое целое в простом формате из не-0-terminated строки.
|
/// Read unsigned integer in a simple form from a non-0-terminated string.
|
||||||
static UInt64 readUIntText(const char * buf, const char * end)
|
static UInt64 readUIntText(const char * buf, const char * end)
|
||||||
{
|
{
|
||||||
UInt64 x = 0;
|
UInt64 x = 0;
|
||||||
@ -59,7 +59,7 @@ static UInt64 readUIntText(const char * buf, const char * end)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Прочитать знаковое целое в простом формате из не-0-terminated строки.
|
/// Read signed integer in a simple form from a non-0-terminated string.
|
||||||
static Int64 readIntText(const char * buf, const char * end)
|
static Int64 readIntText(const char * buf, const char * end)
|
||||||
{
|
{
|
||||||
bool negative = false;
|
bool negative = false;
|
||||||
@ -102,7 +102,7 @@ static Int64 readIntText(const char * buf, const char * end)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Прочитать число с плавающей запятой в простом формате, с грубым округлением, из не-0-terminated строки.
|
/// Read floating point number in simple format, imprecisely, from a non-0-terminated string.
|
||||||
static double readFloatText(const char * buf, const char * end)
|
static double readFloatText(const char * buf, const char * end)
|
||||||
{
|
{
|
||||||
bool negative = false;
|
bool negative = false;
|
||||||
@ -151,8 +151,8 @@ static double readFloatText(const char * buf, const char * end)
|
|||||||
case 'E':
|
case 'E':
|
||||||
{
|
{
|
||||||
++buf;
|
++buf;
|
||||||
Int32 exponent = readIntText(buf, end);
|
auto exponent = readIntText(buf, end);
|
||||||
x *= preciseExp10(exponent);
|
x *= preciseExp10(static_cast<double>(exponent));
|
||||||
|
|
||||||
run = false;
|
run = false;
|
||||||
break;
|
break;
|
||||||
@ -207,7 +207,7 @@ JSON::ElementType JSON::getType() const
|
|||||||
return TYPE_NUMBER;
|
return TYPE_NUMBER;
|
||||||
case '"':
|
case '"':
|
||||||
{
|
{
|
||||||
/// Проверим - это просто строка или name-value pair
|
/// Is it a string or a name-value pair?
|
||||||
Pos after_string = skipString();
|
Pos after_string = skipString();
|
||||||
if (after_string < ptr_end && *after_string == ':')
|
if (after_string < ptr_end && *after_string == ':')
|
||||||
return TYPE_NAME_VALUE_PAIR;
|
return TYPE_NAME_VALUE_PAIR;
|
||||||
@ -229,15 +229,13 @@ void JSON::checkPos(Pos pos) const
|
|||||||
|
|
||||||
JSON::Pos JSON::skipString() const
|
JSON::Pos JSON::skipString() const
|
||||||
{
|
{
|
||||||
//std::cerr << "skipString()\t" << data() << std::endl;
|
|
||||||
|
|
||||||
Pos pos = ptr_begin;
|
Pos pos = ptr_begin;
|
||||||
checkPos(pos);
|
checkPos(pos);
|
||||||
if (*pos != '"')
|
if (*pos != '"')
|
||||||
throw JSONException(std::string("JSON: expected \", got ") + *pos);
|
throw JSONException(std::string("JSON: expected \", got ") + *pos);
|
||||||
++pos;
|
++pos;
|
||||||
|
|
||||||
/// fast path: находим следующую двойную кавычку. Если перед ней нет бэкслеша - значит это конец строки (при допущении корректности JSON).
|
/// fast path: find next double quote. If it is not escaped by backslash - then it's an end of string (assuming JSON is valid).
|
||||||
Pos closing_quote = reinterpret_cast<const char *>(memchr(reinterpret_cast<const void *>(pos), '\"', ptr_end - pos));
|
Pos closing_quote = reinterpret_cast<const char *>(memchr(reinterpret_cast<const void *>(pos), '\"', ptr_end - pos));
|
||||||
if (nullptr != closing_quote && closing_quote[-1] != '\\')
|
if (nullptr != closing_quote && closing_quote[-1] != '\\')
|
||||||
return closing_quote + 1;
|
return closing_quote + 1;
|
||||||
@ -269,8 +267,6 @@ JSON::Pos JSON::skipString() const
|
|||||||
|
|
||||||
JSON::Pos JSON::skipNumber() const
|
JSON::Pos JSON::skipNumber() const
|
||||||
{
|
{
|
||||||
//std::cerr << "skipNumber()\t" << data() << std::endl;
|
|
||||||
|
|
||||||
Pos pos = ptr_begin;
|
Pos pos = ptr_begin;
|
||||||
|
|
||||||
checkPos(pos);
|
checkPos(pos);
|
||||||
@ -296,8 +292,6 @@ JSON::Pos JSON::skipNumber() const
|
|||||||
|
|
||||||
JSON::Pos JSON::skipBool() const
|
JSON::Pos JSON::skipBool() const
|
||||||
{
|
{
|
||||||
//std::cerr << "skipBool()\t" << data() << std::endl;
|
|
||||||
|
|
||||||
Pos pos = ptr_begin;
|
Pos pos = ptr_begin;
|
||||||
checkPos(pos);
|
checkPos(pos);
|
||||||
|
|
||||||
@ -314,16 +308,12 @@ JSON::Pos JSON::skipBool() const
|
|||||||
|
|
||||||
JSON::Pos JSON::skipNull() const
|
JSON::Pos JSON::skipNull() const
|
||||||
{
|
{
|
||||||
//std::cerr << "skipNull()\t" << data() << std::endl;
|
|
||||||
|
|
||||||
return ptr_begin + 4;
|
return ptr_begin + 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
JSON::Pos JSON::skipNameValuePair() const
|
JSON::Pos JSON::skipNameValuePair() const
|
||||||
{
|
{
|
||||||
//std::cerr << "skipNameValuePair()\t" << data() << std::endl;
|
|
||||||
|
|
||||||
Pos pos = skipString();
|
Pos pos = skipString();
|
||||||
checkPos(pos);
|
checkPos(pos);
|
||||||
|
|
||||||
@ -338,8 +328,6 @@ JSON::Pos JSON::skipNameValuePair() const
|
|||||||
|
|
||||||
JSON::Pos JSON::skipArray() const
|
JSON::Pos JSON::skipArray() const
|
||||||
{
|
{
|
||||||
//std::cerr << "skipArray()\t" << data() << std::endl;
|
|
||||||
|
|
||||||
if (!isArray())
|
if (!isArray())
|
||||||
throw JSONException("JSON: expected [");
|
throw JSONException("JSON: expected [");
|
||||||
Pos pos = ptr_begin;
|
Pos pos = ptr_begin;
|
||||||
@ -370,8 +358,6 @@ JSON::Pos JSON::skipArray() const
|
|||||||
|
|
||||||
JSON::Pos JSON::skipObject() const
|
JSON::Pos JSON::skipObject() const
|
||||||
{
|
{
|
||||||
//std::cerr << "skipObject()\t" << data() << std::endl;
|
|
||||||
|
|
||||||
if (!isObject())
|
if (!isObject())
|
||||||
throw JSONException("JSON: expected {");
|
throw JSONException("JSON: expected {");
|
||||||
Pos pos = ptr_begin;
|
Pos pos = ptr_begin;
|
||||||
@ -402,8 +388,6 @@ JSON::Pos JSON::skipObject() const
|
|||||||
|
|
||||||
JSON::Pos JSON::skipElement() const
|
JSON::Pos JSON::skipElement() const
|
||||||
{
|
{
|
||||||
//std::cerr << "skipElement()\t" << data() << std::endl;
|
|
||||||
|
|
||||||
ElementType type = getType();
|
ElementType type = getType();
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
@ -640,7 +624,7 @@ std::string JSON::getString() const
|
|||||||
{
|
{
|
||||||
throw JSONException("JSON: incorrect syntax: incorrect HEX code.");
|
throw JSONException("JSON: incorrect syntax: incorrect HEX code.");
|
||||||
}
|
}
|
||||||
buf.resize(buf.size() + 6); /// максимальный размер UTF8 многобайтовой последовательности
|
buf.resize(buf.size() + 6); /// Max size of UTF-8 sequence, including pre-standard mapping of UCS-4 to UTF-8.
|
||||||
int res = utf8.convert(unicode,
|
int res = utf8.convert(unicode,
|
||||||
reinterpret_cast<unsigned char *>(const_cast<char*>(buf.data())) + buf.size() - 6, 6);
|
reinterpret_cast<unsigned char *>(const_cast<char*>(buf.data())) + buf.size() - 6, 6);
|
||||||
if (!res)
|
if (!res)
|
||||||
@ -754,8 +738,6 @@ JSON::iterator JSON::iterator::begin() const
|
|||||||
if (type != TYPE_ARRAY && type != TYPE_OBJECT)
|
if (type != TYPE_ARRAY && type != TYPE_OBJECT)
|
||||||
throw JSONException("JSON: not array or object when calling begin() method.");
|
throw JSONException("JSON: not array or object when calling begin() method.");
|
||||||
|
|
||||||
//std::cerr << "begin()\t" << data() << std::endl;
|
|
||||||
|
|
||||||
Pos pos = ptr_begin + 1;
|
Pos pos = ptr_begin + 1;
|
||||||
checkPos(pos);
|
checkPos(pos);
|
||||||
if (*pos == '}' || *pos == ']')
|
if (*pos == '}' || *pos == ']')
|
||||||
@ -846,4 +828,3 @@ bool JSON::isType<bool>() const
|
|||||||
{
|
{
|
||||||
return isBool();
|
return isBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ inline UInt64 shiftMix(UInt64 val)
|
|||||||
return val ^ (val >> 47);
|
return val ^ (val >> 47);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline UInt64 rotateByAtLeast1(UInt64 val, int shift)
|
inline UInt64 rotateByAtLeast1(UInt64 val, UInt8 shift)
|
||||||
{
|
{
|
||||||
return (val >> shift) | (val << (64 - shift));
|
return (val >> shift) | (val << (64 - shift));
|
||||||
}
|
}
|
||||||
@ -249,7 +249,7 @@ inline size_t hashLessThan8(const char * data, size_t size)
|
|||||||
uint8_t b = data[size >> 1];
|
uint8_t b = data[size >> 1];
|
||||||
uint8_t c = data[size - 1];
|
uint8_t c = data[size - 1];
|
||||||
uint32_t y = static_cast<uint32_t>(a) + (static_cast<uint32_t>(b) << 8);
|
uint32_t y = static_cast<uint32_t>(a) + (static_cast<uint32_t>(b) << 8);
|
||||||
uint32_t z = size + (static_cast<uint32_t>(c) << 2);
|
uint32_t z = static_cast<uint32_t>(size) + (static_cast<uint32_t>(c) << 2);
|
||||||
return shiftMix(y * k2 ^ z * k3) * k2;
|
return shiftMix(y * k2 ^ z * k3) * k2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ inline size_t hashLessThan16(const char * data, size_t size)
|
|||||||
{
|
{
|
||||||
UInt64 a = unalignedLoad<UInt64>(data);
|
UInt64 a = unalignedLoad<UInt64>(data);
|
||||||
UInt64 b = unalignedLoad<UInt64>(data + size - 8);
|
UInt64 b = unalignedLoad<UInt64>(data + size - 8);
|
||||||
return hashLen16(a, rotateByAtLeast1(b + size, size)) ^ b;
|
return hashLen16(a, rotateByAtLeast1(b + size, static_cast<UInt8>(size))) ^ b;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hashLessThan8(data, size);
|
return hashLessThan8(data, size);
|
||||||
|
@ -22,7 +22,7 @@ uint64_t getThreadId()
|
|||||||
#if defined(OS_ANDROID)
|
#if defined(OS_ANDROID)
|
||||||
current_tid = gettid();
|
current_tid = gettid();
|
||||||
#elif defined(OS_LINUX)
|
#elif defined(OS_LINUX)
|
||||||
current_tid = syscall(SYS_gettid); /// This call is always successful. - man gettid
|
current_tid = static_cast<uint64_t>(syscall(SYS_gettid)); /// This call is always successful. - man gettid
|
||||||
#elif defined(OS_FREEBSD)
|
#elif defined(OS_FREEBSD)
|
||||||
current_tid = pthread_getthreadid_np();
|
current_tid = pthread_getthreadid_np();
|
||||||
#elif defined(OS_SUNOS)
|
#elif defined(OS_SUNOS)
|
||||||
|
@ -52,7 +52,7 @@ static T shift10Impl(T x, int exponent)
|
|||||||
else if (unlikely(exponent > max_exponent))
|
else if (unlikely(exponent > max_exponent))
|
||||||
x *= std::numeric_limits<T>::infinity(); /// Multiplying to keep the sign of infinity.
|
x *= std::numeric_limits<T>::infinity(); /// Multiplying to keep the sign of infinity.
|
||||||
else
|
else
|
||||||
x *= powers10[exponent - min_exponent];
|
x *= static_cast<T>(powers10[exponent - min_exponent]);
|
||||||
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
@ -68,12 +68,12 @@ float shift10(float x, int exponent)
|
|||||||
return shift10Impl(x, exponent);
|
return shift10Impl(x, exponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
double shift10(UInt64 x, int exponent)
|
long double shift10(UInt64 x, int exponent)
|
||||||
{
|
{
|
||||||
return shift10Impl(static_cast<long double>(x), exponent);
|
return shift10Impl(static_cast<long double>(x), exponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
double shift10(Int64 x, int exponent)
|
long double shift10(Int64 x, int exponent)
|
||||||
{
|
{
|
||||||
return shift10Impl(static_cast<long double>(x), exponent);
|
return shift10Impl(static_cast<long double>(x), exponent);
|
||||||
}
|
}
|
||||||
|
@ -12,5 +12,5 @@
|
|||||||
double shift10(double x, int exponent);
|
double shift10(double x, int exponent);
|
||||||
float shift10(float x, int exponent);
|
float shift10(float x, int exponent);
|
||||||
|
|
||||||
double shift10(UInt64 x, int exponent);
|
long double shift10(UInt64 x, int exponent);
|
||||||
double shift10(Int64 x, int exponent);
|
long double shift10(Int64 x, int exponent);
|
||||||
|
@ -11,12 +11,12 @@ std::string setColor(UInt64 hash)
|
|||||||
/// It still looks awesome.
|
/// It still looks awesome.
|
||||||
UInt8 y = 128;
|
UInt8 y = 128;
|
||||||
|
|
||||||
UInt8 cb = hash % 256;
|
UInt8 cb = static_cast<UInt8>(hash % 256);
|
||||||
UInt8 cr = hash / 256 % 256;
|
UInt8 cr = static_cast<UInt8>(hash / 256 % 256);
|
||||||
|
|
||||||
UInt8 r = std::max(0.0, std::min(255.0, y + 1.402 * (cr - 128)));
|
UInt8 r = static_cast<UInt8>(std::max(0.0, std::min(255.0, y + 1.402 * (cr - 128))));
|
||||||
UInt8 g = std::max(0.0, std::min(255.0, y - 0.344136 * (cb - 128) - 0.714136 * (cr - 128)));
|
UInt8 g = static_cast<UInt8>(std::max(0.0, std::min(255.0, y - 0.344136 * (cb - 128) - 0.714136 * (cr - 128))));
|
||||||
UInt8 b = std::max(0.0, std::min(255.0, y + 1.772 * (cb - 128)));
|
UInt8 b = static_cast<UInt8>(std::max(0.0, std::min(255.0, y + 1.772 * (cb - 128))));
|
||||||
|
|
||||||
/// ANSI escape sequence to set 24-bit foreground font color in terminal.
|
/// ANSI escape sequence to set 24-bit foreground font color in terminal.
|
||||||
return "\033[38;2;" + std::to_string(r) + ";" + std::to_string(g) + ";" + std::to_string(b) + "m";
|
return "\033[38;2;" + std::to_string(r) + ";" + std::to_string(g) + ";" + std::to_string(b) + "m";
|
||||||
|
@ -453,7 +453,7 @@ private:
|
|||||||
if constexpr (sizeof(T) <= sizeof(base_type))
|
if constexpr (sizeof(T) <= sizeof(base_type))
|
||||||
{
|
{
|
||||||
if (0 == idx)
|
if (0 == idx)
|
||||||
return x;
|
return static_cast<base_type>(x);
|
||||||
}
|
}
|
||||||
else if (idx * sizeof(base_type) < sizeof(T))
|
else if (idx * sizeof(base_type) < sizeof(T))
|
||||||
return x >> (idx * base_bits); // & std::numeric_limits<base_type>::max()
|
return x >> (idx * base_bits); // & std::numeric_limits<base_type>::max()
|
||||||
@ -1239,13 +1239,13 @@ constexpr integer<Bits, Signed>::operator long double() const noexcept
|
|||||||
template <size_t Bits, typename Signed>
|
template <size_t Bits, typename Signed>
|
||||||
constexpr integer<Bits, Signed>::operator double() const noexcept
|
constexpr integer<Bits, Signed>::operator double() const noexcept
|
||||||
{
|
{
|
||||||
return static_cast<long double>(*this);
|
return static_cast<double>(static_cast<long double>(*this));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <size_t Bits, typename Signed>
|
template <size_t Bits, typename Signed>
|
||||||
constexpr integer<Bits, Signed>::operator float() const noexcept
|
constexpr integer<Bits, Signed>::operator float() const noexcept
|
||||||
{
|
{
|
||||||
return static_cast<long double>(*this);
|
return static_cast<float>(static_cast<long double>(*this));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unary operators
|
// Unary operators
|
||||||
|
@ -833,7 +833,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.frequency_desaturate)
|
if (params.frequency_desaturate > 0.0)
|
||||||
{
|
{
|
||||||
for (auto & elem : table)
|
for (auto & elem : table)
|
||||||
{
|
{
|
||||||
@ -846,7 +846,7 @@ public:
|
|||||||
UInt64 new_total = 0;
|
UInt64 new_total = 0;
|
||||||
for (auto & bucket : histogram.buckets)
|
for (auto & bucket : histogram.buckets)
|
||||||
{
|
{
|
||||||
bucket.second = bucket.second * (1.0 - params.frequency_desaturate) + average * params.frequency_desaturate;
|
bucket.second = static_cast<UInt64>(bucket.second * (1.0 - params.frequency_desaturate) + average * params.frequency_desaturate);
|
||||||
new_total += bucket.second;
|
new_total += bucket.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ class QuantileTDigest
|
|||||||
*/
|
*/
|
||||||
struct Params
|
struct Params
|
||||||
{
|
{
|
||||||
Value epsilon = 0.01;
|
Value epsilon = 0.01f;
|
||||||
size_t max_centroids = 2048;
|
size_t max_centroids = 2048;
|
||||||
size_t max_unmerged = 2048;
|
size_t max_unmerged = 2048;
|
||||||
};
|
};
|
||||||
@ -99,12 +99,11 @@ class QuantileTDigest
|
|||||||
BetterFloat count = 0;
|
BetterFloat count = 0;
|
||||||
size_t unmerged = 0;
|
size_t unmerged = 0;
|
||||||
|
|
||||||
/** Linear interpolation at the point x on the line (x1, y1)..(x2, y2)
|
/// Linear interpolation at the point x on the line (x1, y1)..(x2, y2)
|
||||||
*/
|
|
||||||
static Value interpolate(Value x, Value x1, Value y1, Value x2, Value y2)
|
static Value interpolate(Value x, Value x1, Value y1, Value x2, Value y2)
|
||||||
{
|
{
|
||||||
/// Symmetric interpolation for better results with infinities.
|
/// Symmetric interpolation for better results with infinities.
|
||||||
double k = (x - x1) / (x2 - x1);
|
Value k = (x - x1) / (x2 - x1);
|
||||||
return (1 - k) * y1 + k * y2;
|
return (1 - k) * y1 + k * y2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ namespace detail
|
|||||||
if (!elems.empty())
|
if (!elems.empty())
|
||||||
{
|
{
|
||||||
size_t n = level < 1
|
size_t n = level < 1
|
||||||
? level * elems.size()
|
? static_cast<size_t>(level * elems.size())
|
||||||
: (elems.size() - 1);
|
: (elems.size() - 1);
|
||||||
|
|
||||||
/// Sorting an array will not be considered a violation of constancy.
|
/// Sorting an array will not be considered a violation of constancy.
|
||||||
@ -201,7 +201,7 @@ namespace detail
|
|||||||
auto level = levels[level_index];
|
auto level = levels[level_index];
|
||||||
|
|
||||||
size_t n = level < 1
|
size_t n = level < 1
|
||||||
? level * elems.size()
|
? static_cast<size_t>(level * elems.size())
|
||||||
: (elems.size() - 1);
|
: (elems.size() - 1);
|
||||||
|
|
||||||
::nth_element(array.begin() + prev_n, array.begin() + n, array.end());
|
::nth_element(array.begin() + prev_n, array.begin() + n, array.end());
|
||||||
|
@ -54,7 +54,7 @@ Field QueryFuzzer::getRandomField(int type)
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
static constexpr float values[]
|
static constexpr double values[]
|
||||||
= {NAN, INFINITY, -INFINITY, 0., -0., 0.0001, 0.5, 0.9999,
|
= {NAN, INFINITY, -INFINITY, 0., -0., 0.0001, 0.5, 0.9999,
|
||||||
1., 1.0001, 2., 10.0001, 100.0001, 1000.0001, 1e10, 1e20,
|
1., 1.0001, 2., 10.0001, 100.0001, 1000.0001, 1e10, 1e20,
|
||||||
FLT_MIN, FLT_MIN + FLT_EPSILON, FLT_MAX, FLT_MAX + FLT_EPSILON}; return values[fuzz_rand() % (sizeof(values) / sizeof(*values))];
|
FLT_MIN, FLT_MIN + FLT_EPSILON, FLT_MAX, FLT_MAX + FLT_EPSILON}; return values[fuzz_rand() % (sizeof(values) / sizeof(*values))];
|
||||||
|
@ -607,7 +607,7 @@ MutableColumns ColumnAggregateFunction::scatter(IColumn::ColumnIndex num_columns
|
|||||||
size_t num_rows = size();
|
size_t num_rows = size();
|
||||||
|
|
||||||
{
|
{
|
||||||
size_t reserve_size = static_cast<double>(num_rows) / num_columns * 1.1; /// 1.1 is just a guess. Better to use n-sigma rule.
|
size_t reserve_size = static_cast<size_t>(static_cast<double>(num_rows) / num_columns * 1.1); /// 1.1 is just a guess. Better to use n-sigma rule.
|
||||||
|
|
||||||
if (reserve_size > 1)
|
if (reserve_size > 1)
|
||||||
for (auto & column : columns)
|
for (auto & column : columns)
|
||||||
|
@ -54,7 +54,7 @@ std::vector<IColumn::MutablePtr> IColumn::scatterImpl(ColumnIndex num_columns,
|
|||||||
column = cloneEmpty();
|
column = cloneEmpty();
|
||||||
|
|
||||||
{
|
{
|
||||||
size_t reserve_size = num_rows * 1.1 / num_columns; /// 1.1 is just a guess. Better to use n-sigma rule.
|
size_t reserve_size = static_cast<size_t>(num_rows * 1.1 / num_columns); /// 1.1 is just a guess. Better to use n-sigma rule.
|
||||||
|
|
||||||
if (reserve_size > 1)
|
if (reserve_size > 1)
|
||||||
for (auto & column : columns)
|
for (auto & column : columns)
|
||||||
|
@ -119,7 +119,7 @@ size_t extractMaskNumericImpl(
|
|||||||
(*nulls)[i] = 1;
|
(*nulls)[i] = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
value = !!data[index];
|
value = static_cast<bool>(data[index]);
|
||||||
|
|
||||||
if constexpr (inverted)
|
if constexpr (inverted)
|
||||||
value = !value;
|
value = !value;
|
||||||
@ -335,4 +335,3 @@ void copyMask(const PaddedPODArray<UInt8> & from, PaddedPODArray<UInt8> & to)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ inline size_t roundUpToPowerOfTwoOrZero(size_t n)
|
|||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline size_t getLeadingZeroBitsUnsafe(T x)
|
inline uint32_t getLeadingZeroBitsUnsafe(T x)
|
||||||
{
|
{
|
||||||
assert(x != 0);
|
assert(x != 0);
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ public:
|
|||||||
/// also make the special timezones with no whole hour offset such as 'Australia/Lord_Howe' been taken into account.
|
/// also make the special timezones with no whole hour offset such as 'Australia/Lord_Howe' been taken into account.
|
||||||
|
|
||||||
LUTIndex index = findIndex(t);
|
LUTIndex index = findIndex(t);
|
||||||
UInt32 time = t - lut[index].date;
|
UInt32 time = static_cast<UInt32>(t - lut[index].date);
|
||||||
|
|
||||||
if (time >= lut[index].time_at_offset_change())
|
if (time >= lut[index].time_at_offset_change())
|
||||||
time += lut[index].amount_of_offset_change();
|
time += lut[index].amount_of_offset_change();
|
||||||
@ -618,33 +618,33 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename DateOrTime>
|
template <typename DateOrTime>
|
||||||
inline unsigned toMonth(DateOrTime v) const { return lut[toLUTIndex(v)].month; }
|
inline UInt8 toMonth(DateOrTime v) const { return lut[toLUTIndex(v)].month; }
|
||||||
|
|
||||||
template <typename DateOrTime>
|
template <typename DateOrTime>
|
||||||
inline unsigned toQuarter(DateOrTime v) const { return (lut[toLUTIndex(v)].month - 1) / 3 + 1; }
|
inline UInt8 toQuarter(DateOrTime v) const { return (lut[toLUTIndex(v)].month - 1) / 3 + 1; }
|
||||||
|
|
||||||
template <typename DateOrTime>
|
template <typename DateOrTime>
|
||||||
inline Int16 toYear(DateOrTime v) const { return lut[toLUTIndex(v)].year; }
|
inline Int16 toYear(DateOrTime v) const { return lut[toLUTIndex(v)].year; }
|
||||||
|
|
||||||
template <typename DateOrTime>
|
template <typename DateOrTime>
|
||||||
inline unsigned toDayOfWeek(DateOrTime v) const { return lut[toLUTIndex(v)].day_of_week; }
|
inline UInt8 toDayOfWeek(DateOrTime v) const { return lut[toLUTIndex(v)].day_of_week; }
|
||||||
|
|
||||||
template <typename DateOrTime>
|
template <typename DateOrTime>
|
||||||
inline unsigned toDayOfMonth(DateOrTime v) const { return lut[toLUTIndex(v)].day_of_month; }
|
inline UInt8 toDayOfMonth(DateOrTime v) const { return lut[toLUTIndex(v)].day_of_month; }
|
||||||
|
|
||||||
template <typename DateOrTime>
|
template <typename DateOrTime>
|
||||||
inline unsigned toDayOfYear(DateOrTime v) const
|
inline UInt16 toDayOfYear(DateOrTime v) const
|
||||||
{
|
{
|
||||||
// TODO: different overload for ExtendedDayNum
|
// TODO: different overload for ExtendedDayNum
|
||||||
const LUTIndex i = toLUTIndex(v);
|
const LUTIndex i = toLUTIndex(v);
|
||||||
return i + 1 - toFirstDayNumOfYearIndex(i);
|
return static_cast<UInt16>(i + 1 - toFirstDayNumOfYearIndex(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Number of week from some fixed moment in the past. Week begins at monday.
|
/// Number of week from some fixed moment in the past. Week begins at monday.
|
||||||
/// (round down to monday and divide DayNum by 7; we made an assumption,
|
/// (round down to monday and divide DayNum by 7; we made an assumption,
|
||||||
/// that in domain of the function there was no weeks with any other number of days than 7)
|
/// that in domain of the function there was no weeks with any other number of days than 7)
|
||||||
template <typename DateOrTime>
|
template <typename DateOrTime>
|
||||||
inline unsigned toRelativeWeekNum(DateOrTime v) const
|
inline Int32 toRelativeWeekNum(DateOrTime v) const
|
||||||
{
|
{
|
||||||
const LUTIndex i = toLUTIndex(v);
|
const LUTIndex i = toLUTIndex(v);
|
||||||
/// We add 8 to avoid underflow at beginning of unix epoch.
|
/// We add 8 to avoid underflow at beginning of unix epoch.
|
||||||
@ -653,7 +653,7 @@ public:
|
|||||||
|
|
||||||
/// Get year that contains most of the current week. Week begins at monday.
|
/// Get year that contains most of the current week. Week begins at monday.
|
||||||
template <typename DateOrTime>
|
template <typename DateOrTime>
|
||||||
inline unsigned toISOYear(DateOrTime v) const
|
inline Int16 toISOYear(DateOrTime v) const
|
||||||
{
|
{
|
||||||
const LUTIndex i = toLUTIndex(v);
|
const LUTIndex i = toLUTIndex(v);
|
||||||
/// That's effectively the year of thursday of current week.
|
/// That's effectively the year of thursday of current week.
|
||||||
@ -694,7 +694,7 @@ public:
|
|||||||
/// ISO 8601 week number. Week begins at monday.
|
/// ISO 8601 week number. Week begins at monday.
|
||||||
/// The week number 1 is the first week in year that contains 4 or more days (that's more than half).
|
/// The week number 1 is the first week in year that contains 4 or more days (that's more than half).
|
||||||
template <typename DateOrTime>
|
template <typename DateOrTime>
|
||||||
inline unsigned toISOWeek(DateOrTime v) const
|
inline UInt8 toISOWeek(DateOrTime v) const
|
||||||
{
|
{
|
||||||
return 1 + (toFirstDayNumOfWeek(v) - toDayNum(toFirstDayNumOfISOYearIndex(v))) / 7;
|
return 1 + (toFirstDayNumOfWeek(v) - toDayNum(toFirstDayNumOfISOYearIndex(v))) / 7;
|
||||||
}
|
}
|
||||||
@ -751,38 +751,40 @@ public:
|
|||||||
|
|
||||||
YearWeek yw(toYear(i), 0);
|
YearWeek yw(toYear(i), 0);
|
||||||
UInt16 days = 0;
|
UInt16 days = 0;
|
||||||
const auto daynr = makeDayNum(yw.first, toMonth(i), toDayOfMonth(i));
|
const auto day_number = makeDayNum(yw.first, toMonth(i), toDayOfMonth(i));
|
||||||
auto first_daynr = makeDayNum(yw.first, 1, 1);
|
auto first_day_number = makeDayNum(yw.first, 1, 1);
|
||||||
|
|
||||||
// 0 for monday, 1 for tuesday ...
|
// 0 for monday, 1 for tuesday ...
|
||||||
// get weekday from first day in year.
|
// get weekday from first day in year.
|
||||||
UInt16 weekday = calc_weekday(first_daynr, !monday_first_mode);
|
UInt8 weekday = calc_weekday(first_day_number, !monday_first_mode);
|
||||||
|
|
||||||
if (toMonth(i) == 1 && toDayOfMonth(i) <= static_cast<UInt32>(7 - weekday))
|
if (toMonth(i) == 1 && toDayOfMonth(i) <= static_cast<UInt32>(7 - weekday))
|
||||||
{
|
{
|
||||||
if (!week_year_mode && ((first_weekday_mode && weekday != 0) || (!first_weekday_mode && weekday >= 4)))
|
if (!week_year_mode && ((first_weekday_mode && weekday != 0) || (!first_weekday_mode && weekday >= 4)))
|
||||||
return yw;
|
return yw;
|
||||||
week_year_mode = true;
|
week_year_mode = true;
|
||||||
(yw.first)--;
|
--yw.first;
|
||||||
first_daynr -= (days = calc_days_in_year(yw.first));
|
days = calc_days_in_year(yw.first);
|
||||||
|
first_day_number -= days;
|
||||||
weekday = (weekday + 53 * 7 - days) % 7;
|
weekday = (weekday + 53 * 7 - days) % 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((first_weekday_mode && weekday != 0) || (!first_weekday_mode && weekday >= 4))
|
if ((first_weekday_mode && weekday != 0) || (!first_weekday_mode && weekday >= 4))
|
||||||
days = daynr - (first_daynr + (7 - weekday));
|
days = day_number - (first_day_number + (7 - weekday));
|
||||||
else
|
else
|
||||||
days = daynr - (first_daynr - weekday);
|
days = day_number - (first_day_number - weekday);
|
||||||
|
|
||||||
if (week_year_mode && days >= 52 * 7)
|
if (week_year_mode && days >= 52 * 7)
|
||||||
{
|
{
|
||||||
weekday = (weekday + calc_days_in_year(yw.first)) % 7;
|
weekday = (weekday + calc_days_in_year(yw.first)) % 7;
|
||||||
if ((!first_weekday_mode && weekday < 4) || (first_weekday_mode && weekday == 0))
|
if ((!first_weekday_mode && weekday < 4) || (first_weekday_mode && weekday == 0))
|
||||||
{
|
{
|
||||||
(yw.first)++;
|
++yw.first;
|
||||||
yw.second = 1;
|
yw.second = 1;
|
||||||
return yw;
|
return yw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
yw.second = days / 7 + 1;
|
yw.second = days / 7 + 1;
|
||||||
return yw;
|
return yw;
|
||||||
}
|
}
|
||||||
@ -853,7 +855,7 @@ public:
|
|||||||
* Returns 0 for monday, 1 for tuesday...
|
* Returns 0 for monday, 1 for tuesday...
|
||||||
*/
|
*/
|
||||||
template <typename DateOrTime>
|
template <typename DateOrTime>
|
||||||
inline unsigned calc_weekday(DateOrTime v, bool sunday_first_day_of_week) const /// NOLINT
|
inline UInt8 calc_weekday(DateOrTime v, bool sunday_first_day_of_week) const /// NOLINT
|
||||||
{
|
{
|
||||||
const LUTIndex i = toLUTIndex(v);
|
const LUTIndex i = toLUTIndex(v);
|
||||||
if (!sunday_first_day_of_week)
|
if (!sunday_first_day_of_week)
|
||||||
@ -863,21 +865,21 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Calculate days in one year.
|
/// Calculate days in one year.
|
||||||
inline unsigned calc_days_in_year(Int32 year) const /// NOLINT
|
inline UInt16 calc_days_in_year(Int32 year) const /// NOLINT
|
||||||
{
|
{
|
||||||
return ((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year)) ? 366 : 365);
|
return ((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year)) ? 366 : 365);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Number of month from some fixed moment in the past (year * 12 + month)
|
/// Number of month from some fixed moment in the past (year * 12 + month)
|
||||||
template <typename DateOrTime>
|
template <typename DateOrTime>
|
||||||
inline unsigned toRelativeMonthNum(DateOrTime v) const
|
inline Int32 toRelativeMonthNum(DateOrTime v) const
|
||||||
{
|
{
|
||||||
const LUTIndex i = toLUTIndex(v);
|
const LUTIndex i = toLUTIndex(v);
|
||||||
return lut[i].year * 12 + lut[i].month;
|
return lut[i].year * 12 + lut[i].month;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename DateOrTime>
|
template <typename DateOrTime>
|
||||||
inline unsigned toRelativeQuarterNum(DateOrTime v) const
|
inline Int32 toRelativeQuarterNum(DateOrTime v) const
|
||||||
{
|
{
|
||||||
const LUTIndex i = toLUTIndex(v);
|
const LUTIndex i = toLUTIndex(v);
|
||||||
return lut[i].year * 4 + (lut[i].month - 1) / 3;
|
return lut[i].year * 4 + (lut[i].month - 1) / 3;
|
||||||
|
@ -674,7 +674,7 @@ namespace ErrorCodes
|
|||||||
|
|
||||||
ErrorCode getErrorCodeByName(std::string_view error_name)
|
ErrorCode getErrorCodeByName(std::string_view error_name)
|
||||||
{
|
{
|
||||||
for (size_t i = 0, end = ErrorCodes::end(); i < end; ++i)
|
for (int i = 0, end = ErrorCodes::end(); i < end; ++i)
|
||||||
{
|
{
|
||||||
std::string_view name = ErrorCodes::getName(i);
|
std::string_view name = ErrorCodes::getName(i);
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
int getLineNumber() const { return line_number; }
|
ssize_t getLineNumber() const { return line_number; }
|
||||||
void setLineNumber(int line_number_) { line_number = line_number_;}
|
void setLineNumber(int line_number_) { line_number = line_number_;}
|
||||||
|
|
||||||
String getFileName() const { return file_name; }
|
String getFileName() const { return file_name; }
|
||||||
|
@ -178,7 +178,7 @@ void MemoryTracker::allocImpl(Int64 size, bool throw_if_memory_exceeded, MemoryT
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::bernoulli_distribution sample(sample_probability);
|
std::bernoulli_distribution sample(sample_probability);
|
||||||
if (unlikely(sample_probability && sample(thread_local_rng)))
|
if (unlikely(sample_probability > 0.0 && sample(thread_local_rng)))
|
||||||
{
|
{
|
||||||
MemoryTrackerBlockerInThread untrack_lock(VariableContext::Global);
|
MemoryTrackerBlockerInThread untrack_lock(VariableContext::Global);
|
||||||
DB::TraceCollector::collect(DB::TraceType::MemorySample, StackTrace(), size);
|
DB::TraceCollector::collect(DB::TraceType::MemorySample, StackTrace(), size);
|
||||||
@ -186,7 +186,7 @@ void MemoryTracker::allocImpl(Int64 size, bool throw_if_memory_exceeded, MemoryT
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::bernoulli_distribution fault(fault_probability);
|
std::bernoulli_distribution fault(fault_probability);
|
||||||
if (unlikely(fault_probability && fault(thread_local_rng)))
|
if (unlikely(fault_probability > 0.0 && fault(thread_local_rng)))
|
||||||
{
|
{
|
||||||
if (memoryTrackerCanThrow(level, true) && throw_if_memory_exceeded)
|
if (memoryTrackerCanThrow(level, true) && throw_if_memory_exceeded)
|
||||||
{
|
{
|
||||||
@ -318,7 +318,7 @@ void MemoryTracker::free(Int64 size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::bernoulli_distribution sample(sample_probability);
|
std::bernoulli_distribution sample(sample_probability);
|
||||||
if (unlikely(sample_probability && sample(thread_local_rng)))
|
if (unlikely(sample_probability > 0.0 && sample(thread_local_rng)))
|
||||||
{
|
{
|
||||||
MemoryTrackerBlockerInThread untrack_lock(VariableContext::Global);
|
MemoryTrackerBlockerInThread untrack_lock(VariableContext::Global);
|
||||||
DB::TraceCollector::collect(DB::TraceType::MemorySample, StackTrace(), -size);
|
DB::TraceCollector::collect(DB::TraceType::MemorySample, StackTrace(), -size);
|
||||||
|
@ -35,7 +35,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
/// TODO: construct from special struct with cache policy parameters (also with max_protected_size).
|
/// TODO: construct from special struct with cache policy parameters (also with max_protected_size).
|
||||||
SLRUCachePolicy(size_t max_size_, size_t max_elements_size_ = 0, double size_ratio = 0.5, OnWeightLossFunction on_weight_loss_function_ = {})
|
SLRUCachePolicy(size_t max_size_, size_t max_elements_size_ = 0, double size_ratio = 0.5, OnWeightLossFunction on_weight_loss_function_ = {})
|
||||||
: max_protected_size(max_size_ * std::min(1.0, size_ratio))
|
: max_protected_size(static_cast<size_t>(max_size_ * std::min(1.0, size_ratio)))
|
||||||
, max_size(max_size_)
|
, max_size(max_size_)
|
||||||
, max_elements_size(max_elements_size_)
|
, max_elements_size(max_elements_size_)
|
||||||
{
|
{
|
||||||
|
@ -55,7 +55,7 @@ private:
|
|||||||
ALWAYS_INLINE void finalize()
|
ALWAYS_INLINE void finalize()
|
||||||
{
|
{
|
||||||
/// In the last free byte, we write the remainder of the division by 256.
|
/// In the last free byte, we write the remainder of the division by 256.
|
||||||
current_bytes[7] = cnt;
|
current_bytes[7] = static_cast<UInt8>(cnt);
|
||||||
|
|
||||||
v3 ^= current_word;
|
v3 ^= current_word;
|
||||||
SIPROUND;
|
SIPROUND;
|
||||||
|
@ -31,7 +31,7 @@ private:
|
|||||||
|
|
||||||
double avg() const
|
double avg() const
|
||||||
{
|
{
|
||||||
return sum / size;
|
return sum / static_cast<double>(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
double var() const
|
double var() const
|
||||||
|
@ -157,22 +157,22 @@ bool ThreadFuzzer::isEffective() const
|
|||||||
|
|
||||||
#if THREAD_FUZZER_WRAP_PTHREAD
|
#if THREAD_FUZZER_WRAP_PTHREAD
|
||||||
# define CHECK_WRAPPER_PARAMS(RET, NAME, ...) \
|
# define CHECK_WRAPPER_PARAMS(RET, NAME, ...) \
|
||||||
if (NAME##_before_yield_probability.load(std::memory_order_relaxed)) \
|
if (NAME##_before_yield_probability.load(std::memory_order_relaxed) > 0.0) \
|
||||||
return true; \
|
return true; \
|
||||||
if (NAME##_before_migrate_probability.load(std::memory_order_relaxed)) \
|
if (NAME##_before_migrate_probability.load(std::memory_order_relaxed) > 0.0) \
|
||||||
return true; \
|
return true; \
|
||||||
if (NAME##_before_sleep_probability.load(std::memory_order_relaxed)) \
|
if (NAME##_before_sleep_probability.load(std::memory_order_relaxed) > 0.0) \
|
||||||
return true; \
|
return true; \
|
||||||
if (NAME##_before_sleep_time_us.load(std::memory_order_relaxed)) \
|
if (NAME##_before_sleep_time_us.load(std::memory_order_relaxed) > 0.0) \
|
||||||
return true; \
|
return true; \
|
||||||
\
|
\
|
||||||
if (NAME##_after_yield_probability.load(std::memory_order_relaxed)) \
|
if (NAME##_after_yield_probability.load(std::memory_order_relaxed) > 0.0) \
|
||||||
return true; \
|
return true; \
|
||||||
if (NAME##_after_migrate_probability.load(std::memory_order_relaxed)) \
|
if (NAME##_after_migrate_probability.load(std::memory_order_relaxed) > 0.0) \
|
||||||
return true; \
|
return true; \
|
||||||
if (NAME##_after_sleep_probability.load(std::memory_order_relaxed)) \
|
if (NAME##_after_sleep_probability.load(std::memory_order_relaxed) > 0.0) \
|
||||||
return true; \
|
return true; \
|
||||||
if (NAME##_after_sleep_time_us.load(std::memory_order_relaxed)) \
|
if (NAME##_after_sleep_time_us.load(std::memory_order_relaxed) > 0.0) \
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
FOR_EACH_WRAPPED_FUNCTION(CHECK_WRAPPER_PARAMS)
|
FOR_EACH_WRAPPED_FUNCTION(CHECK_WRAPPER_PARAMS)
|
||||||
@ -239,7 +239,7 @@ static void injection(
|
|||||||
&& sleep_time_us > 0
|
&& sleep_time_us > 0
|
||||||
&& std::bernoulli_distribution(sleep_probability)(thread_local_rng))
|
&& std::bernoulli_distribution(sleep_probability)(thread_local_rng))
|
||||||
{
|
{
|
||||||
sleepForNanoseconds(sleep_time_us * 1000);
|
sleepForNanoseconds(static_cast<uint64_t>(sleep_time_us * 1000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,8 +558,8 @@ void PerfEventsCounters::finalizeProfileEvents(ProfileEvents::Counters & profile
|
|||||||
// deltas from old values.
|
// deltas from old values.
|
||||||
const auto enabled = current_value.time_enabled - previous_value.time_enabled;
|
const auto enabled = current_value.time_enabled - previous_value.time_enabled;
|
||||||
const auto running = current_value.time_running - previous_value.time_running;
|
const auto running = current_value.time_running - previous_value.time_running;
|
||||||
const UInt64 delta = (current_value.value - previous_value.value)
|
const UInt64 delta = static_cast<UInt64>(
|
||||||
* enabled / std::max(1.f, float(running));
|
(current_value.value - previous_value.value) * enabled / std::max(1.f, float(running)));
|
||||||
|
|
||||||
if (min_enabled_time > enabled)
|
if (min_enabled_time > enabled)
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,7 @@ void Throttler::add(size_t amount)
|
|||||||
if (max_speed && current_speed > max_speed)
|
if (max_speed && current_speed > max_speed)
|
||||||
{
|
{
|
||||||
/// If we was too fast then we have to sleep until our smoothed speed became <= max_speed
|
/// If we was too fast then we have to sleep until our smoothed speed became <= max_speed
|
||||||
int64_t sleep_time = -window_ns * std::log2(max_speed / current_speed);
|
int64_t sleep_time = static_cast<int64_t>(-window_ns * std::log2(max_speed / current_speed));
|
||||||
|
|
||||||
if (sleep_time > 0)
|
if (sleep_time > 0)
|
||||||
{
|
{
|
||||||
|
@ -28,12 +28,12 @@ namespace UnicodeBar
|
|||||||
|
|
||||||
size_t getWidthInBytes(double width)
|
size_t getWidthInBytes(double width)
|
||||||
{
|
{
|
||||||
return ceil(width - 1.0 / 8) * UNICODE_BAR_CHAR_SIZE;
|
return static_cast<size_t>(ceil(width - 1.0 / 8) * UNICODE_BAR_CHAR_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void render(double width, char * dst)
|
void render(double width, char * dst)
|
||||||
{
|
{
|
||||||
size_t floor_width = floor(width);
|
size_t floor_width = static_cast<size_t>(floor(width));
|
||||||
|
|
||||||
for (size_t i = 0; i < floor_width; ++i)
|
for (size_t i = 0; i < floor_width; ++i)
|
||||||
{
|
{
|
||||||
@ -41,7 +41,7 @@ namespace UnicodeBar
|
|||||||
dst += UNICODE_BAR_CHAR_SIZE;
|
dst += UNICODE_BAR_CHAR_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t remainder = floor((width - floor_width) * 8);
|
size_t remainder = static_cast<size_t>(floor((width - floor_width) * 8));
|
||||||
|
|
||||||
if (remainder)
|
if (remainder)
|
||||||
{
|
{
|
||||||
@ -59,4 +59,3 @@ namespace UnicodeBar
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,23 +40,17 @@ int VersionNumber::compare(const VersionNumber & rhs) const
|
|||||||
size_t min = std::min(components.size(), rhs.components.size());
|
size_t min = std::min(components.size(), rhs.components.size());
|
||||||
for (size_t i = 0; i < min; ++i)
|
for (size_t i = 0; i < min; ++i)
|
||||||
{
|
{
|
||||||
if (int d = components[i] - rhs.components[i])
|
if (auto d = components[i] - rhs.components[i])
|
||||||
return d;
|
return d > 0 ? 1 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (components.size() > min)
|
if (components.size() > min)
|
||||||
{
|
{
|
||||||
if (components[min] != 0)
|
return components[min] >= 0 ? 1 : -1;
|
||||||
return components[min];
|
|
||||||
else
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
else if (rhs.components.size() > min)
|
else if (rhs.components.size() > min)
|
||||||
{
|
{
|
||||||
if (rhs.components[min] != 0)
|
return -rhs.components[min] > 0 ? 1 : -1;
|
||||||
return -rhs.components[min];
|
|
||||||
else
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -319,7 +319,7 @@ public:
|
|||||||
|
|
||||||
void setZooKeeperLog(std::shared_ptr<DB::ZooKeeperLog> zk_log_);
|
void setZooKeeperLog(std::shared_ptr<DB::ZooKeeperLog> zk_log_);
|
||||||
|
|
||||||
UInt32 getSessionUptime() const { return session_uptime.elapsedSeconds(); }
|
UInt32 getSessionUptime() const { return static_cast<UInt32>(session_uptime.elapsedSeconds()); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class EphemeralNodeHolder;
|
friend class EphemeralNodeHolder;
|
||||||
|
@ -28,8 +28,8 @@ struct ZooKeeperArgs
|
|||||||
int32_t connection_timeout_ms = Coordination::DEFAULT_CONNECTION_TIMEOUT_MS;
|
int32_t connection_timeout_ms = Coordination::DEFAULT_CONNECTION_TIMEOUT_MS;
|
||||||
int32_t session_timeout_ms = Coordination::DEFAULT_SESSION_TIMEOUT_MS;
|
int32_t session_timeout_ms = Coordination::DEFAULT_SESSION_TIMEOUT_MS;
|
||||||
int32_t operation_timeout_ms = Coordination::DEFAULT_OPERATION_TIMEOUT_MS;
|
int32_t operation_timeout_ms = Coordination::DEFAULT_OPERATION_TIMEOUT_MS;
|
||||||
float send_fault_probability = 0;
|
double send_fault_probability = 0.0;
|
||||||
float recv_fault_probability = 0;
|
double recv_fault_probability = 0.0;
|
||||||
|
|
||||||
DB::GetPriorityForLoadBalancing get_priority_load_balancing;
|
DB::GetPriorityForLoadBalancing get_priority_load_balancing;
|
||||||
};
|
};
|
||||||
|
@ -101,7 +101,7 @@ __attribute__((__weak__)) void checkStackSize()
|
|||||||
throw Exception("Logical error: frame address is greater than stack begin address", ErrorCodes::LOGICAL_ERROR);
|
throw Exception("Logical error: frame address is greater than stack begin address", ErrorCodes::LOGICAL_ERROR);
|
||||||
|
|
||||||
size_t stack_size = int_stack_address + max_stack_size - int_frame_address;
|
size_t stack_size = int_stack_address + max_stack_size - int_frame_address;
|
||||||
size_t max_stack_size_allowed = max_stack_size * STACK_SIZE_FREE_RATIO;
|
size_t max_stack_size_allowed = static_cast<size_t>(max_stack_size * STACK_SIZE_FREE_RATIO);
|
||||||
|
|
||||||
/// Just check if we have eat more than a STACK_SIZE_FREE_RATIO of stack size already.
|
/// Just check if we have eat more than a STACK_SIZE_FREE_RATIO of stack size already.
|
||||||
if (stack_size > max_stack_size_allowed)
|
if (stack_size > max_stack_size_allowed)
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#if defined(OS_LINUX)
|
#if defined(OS_LINUX)
|
||||||
static int readFrom(const char * filename, int default_value)
|
static int32_t readFrom(const char * filename, int default_value)
|
||||||
{
|
{
|
||||||
std::ifstream infile(filename);
|
std::ifstream infile(filename);
|
||||||
if (!infile.is_open())
|
if (!infile.is_open())
|
||||||
@ -22,15 +22,15 @@ static int readFrom(const char * filename, int default_value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Try to look at cgroups limit if it is available.
|
/// Try to look at cgroups limit if it is available.
|
||||||
static unsigned getCGroupLimitedCPUCores(unsigned default_cpu_count)
|
static uint32_t getCGroupLimitedCPUCores(unsigned default_cpu_count)
|
||||||
{
|
{
|
||||||
unsigned quota_count = default_cpu_count;
|
uint32_t quota_count = default_cpu_count;
|
||||||
/// Return the number of milliseconds per period process is guaranteed to run.
|
/// Return the number of milliseconds per period process is guaranteed to run.
|
||||||
/// -1 for no quota
|
/// -1 for no quota
|
||||||
int cgroup_quota = readFrom("/sys/fs/cgroup/cpu/cpu.cfs_quota_us", -1);
|
int cgroup_quota = readFrom("/sys/fs/cgroup/cpu/cpu.cfs_quota_us", -1);
|
||||||
int cgroup_period = readFrom("/sys/fs/cgroup/cpu/cpu.cfs_period_us", -1);
|
int cgroup_period = readFrom("/sys/fs/cgroup/cpu/cpu.cfs_period_us", -1);
|
||||||
if (cgroup_quota > -1 && cgroup_period > 0)
|
if (cgroup_quota > -1 && cgroup_period > 0)
|
||||||
quota_count = ceil(static_cast<float>(cgroup_quota) / static_cast<float>(cgroup_period));
|
quota_count = static_cast<uint32_t>(ceil(static_cast<float>(cgroup_quota) / static_cast<float>(cgroup_period)));
|
||||||
|
|
||||||
return std::min(default_cpu_count, quota_count);
|
return std::min(default_cpu_count, quota_count);
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,6 @@ template <> inline long Value::get<long >() cons
|
|||||||
template <> inline unsigned long Value::get<unsigned long >() const { return getUInt(); } /// NOLINT
|
template <> inline unsigned long Value::get<unsigned long >() const { return getUInt(); } /// NOLINT
|
||||||
template <> inline long long Value::get<long long >() const { return getInt(); } /// NOLINT
|
template <> inline long long Value::get<long long >() const { return getInt(); } /// NOLINT
|
||||||
template <> inline unsigned long long Value::get<unsigned long long >() const { return getUInt(); } /// NOLINT
|
template <> inline unsigned long long Value::get<unsigned long long >() const { return getUInt(); } /// NOLINT
|
||||||
template <> inline float Value::get<float >() const { return getDouble(); }
|
|
||||||
template <> inline double Value::get<double >() const { return getDouble(); }
|
template <> inline double Value::get<double >() const { return getDouble(); }
|
||||||
template <> inline std::string Value::get<std::string >() const { return getString(); }
|
template <> inline std::string Value::get<std::string >() const { return getString(); }
|
||||||
template <> inline LocalDate Value::get<LocalDate >() const { return getDate(); }
|
template <> inline LocalDate Value::get<LocalDate >() const { return getDate(); }
|
||||||
|
@ -885,25 +885,25 @@ inline char & Field::reinterpret<char>()
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
T get(const Field & field)
|
T get(const Field & field)
|
||||||
{
|
{
|
||||||
return field.template get<T>();
|
return static_cast<T>(field.template get<T>());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T get(Field & field)
|
T get(Field & field)
|
||||||
{
|
{
|
||||||
return field.template get<T>();
|
return static_cast<T>(field.template get<T>());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T safeGet(const Field & field)
|
T safeGet(const Field & field)
|
||||||
{
|
{
|
||||||
return field.template safeGet<T>();
|
return static_cast<T>(field.template safeGet<T>());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T safeGet(Field & field)
|
T safeGet(Field & field)
|
||||||
{
|
{
|
||||||
return field.template safeGet<T>();
|
return static_cast<T>(field.template safeGet<T>());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -1036,4 +1036,3 @@ struct fmt::formatter<DB::Field>
|
|||||||
return format_to(ctx.out(), "{}", toString(x));
|
return format_to(ctx.out(), "{}", toString(x));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,9 +42,9 @@ void MySQLClient::connect()
|
|||||||
disconnect();
|
disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
const Poco::Timespan connection_timeout(10 * 1e9);
|
const Poco::Timespan connection_timeout(10'000'000'000);
|
||||||
const Poco::Timespan receive_timeout(5 * 1e9);
|
const Poco::Timespan receive_timeout(5'000'000'000);
|
||||||
const Poco::Timespan send_timeout(5 * 1e9);
|
const Poco::Timespan send_timeout(5'000'000'000);
|
||||||
|
|
||||||
socket = std::make_unique<Poco::Net::StreamSocket>();
|
socket = std::make_unique<Poco::Net::StreamSocket>();
|
||||||
address = DNSResolver::instance().resolveAddress(host, port);
|
address = DNSResolver::instance().resolveAddress(host, port);
|
||||||
@ -152,7 +152,7 @@ void MySQLClient::startBinlogDumpGTID(UInt32 slave_id, String replicate_db, std:
|
|||||||
setBinlogChecksum(binlog_checksum);
|
setBinlogChecksum(binlog_checksum);
|
||||||
|
|
||||||
/// Set heartbeat 1s.
|
/// Set heartbeat 1s.
|
||||||
UInt64 period_ns = (1 * 1e9);
|
UInt64 period_ns = 1'000'000'000;
|
||||||
writeCommand(Command::COM_QUERY, "SET @master_heartbeat_period = " + std::to_string(period_ns));
|
writeCommand(Command::COM_QUERY, "SET @master_heartbeat_period = " + std::to_string(period_ns));
|
||||||
|
|
||||||
// Register slave.
|
// Register slave.
|
||||||
|
@ -43,7 +43,7 @@ private:
|
|||||||
{
|
{
|
||||||
Poco::Net::SocketAddress socket_address(host, port);
|
Poco::Net::SocketAddress socket_address(host, port);
|
||||||
Poco::Net::StreamSocket socket(socket_address);
|
Poco::Net::StreamSocket socket(socket_address);
|
||||||
socket.setSendTimeout(Poco::Timespan(timeout * 1000000));
|
socket.setSendTimeout(Poco::Timespan(static_cast<Poco::Int64>(timeout * 1000000)));
|
||||||
Poco::Net::SocketStream str(socket);
|
Poco::Net::SocketStream str(socket);
|
||||||
|
|
||||||
out(str, data, timestamp, custom_root_path);
|
out(str, data, timestamp, custom_root_path);
|
||||||
|
@ -165,7 +165,7 @@ void SerializationString::deserializeBinaryBulk(IColumn & column, ReadBuffer & i
|
|||||||
|
|
||||||
double avg_chars_size = 1; /// By default reserve only for empty strings.
|
double avg_chars_size = 1; /// By default reserve only for empty strings.
|
||||||
|
|
||||||
if (avg_value_size_hint && avg_value_size_hint > sizeof(offsets[0]))
|
if (avg_value_size_hint > 0.0 && avg_value_size_hint > sizeof(offsets[0]))
|
||||||
{
|
{
|
||||||
/// Randomly selected.
|
/// Randomly selected.
|
||||||
constexpr auto avg_value_size_hint_reserve_multiplier = 1.2;
|
constexpr auto avg_value_size_hint_reserve_multiplier = 1.2;
|
||||||
@ -173,7 +173,7 @@ void SerializationString::deserializeBinaryBulk(IColumn & column, ReadBuffer & i
|
|||||||
avg_chars_size = (avg_value_size_hint - sizeof(offsets[0])) * avg_value_size_hint_reserve_multiplier;
|
avg_chars_size = (avg_value_size_hint - sizeof(offsets[0])) * avg_value_size_hint_reserve_multiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t size_to_reserve = data.size() + std::ceil(limit * avg_chars_size);
|
size_t size_to_reserve = data.size() + static_cast<size_t>(std::ceil(limit * avg_chars_size));
|
||||||
|
|
||||||
/// Never reserve for too big size.
|
/// Never reserve for too big size.
|
||||||
if (size_to_reserve < 256 * 1024 * 1024)
|
if (size_to_reserve < 256 * 1024 * 1024)
|
||||||
|
@ -386,7 +386,7 @@ struct TypedExecutorInvoker<Op, Type, Types ...>
|
|||||||
std::transform(
|
std::transform(
|
||||||
x.getData().cbegin(), x.getData().cend(),
|
x.getData().cbegin(), x.getData().cend(),
|
||||||
column->getData().cbegin(), result.begin(),
|
column->getData().cbegin(), result.begin(),
|
||||||
[](const auto a, const auto b) { return Op::apply(!!a, !!b); });
|
[](const auto a, const auto b) { return Op::apply(static_cast<bool>(a), static_cast<bool>(b)); });
|
||||||
else
|
else
|
||||||
TypedExecutorInvoker<Op, Types ...>::template apply<T>(x, y, result);
|
TypedExecutorInvoker<Op, Types ...>::template apply<T>(x, y, result);
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ void MySQLPacketPayloadWriteBuffer::setWorkingBuffer()
|
|||||||
|
|
||||||
void MySQLPacketPayloadWriteBuffer::nextImpl()
|
void MySQLPacketPayloadWriteBuffer::nextImpl()
|
||||||
{
|
{
|
||||||
const int written = pos - working_buffer.begin();
|
size_t written = pos - working_buffer.begin();
|
||||||
if (eof)
|
if (eof)
|
||||||
throw Exception("Cannot write after end of buffer.", ErrorCodes::CANNOT_WRITE_AFTER_END_OF_BUFFER);
|
throw Exception("Cannot write after end of buffer.", ErrorCodes::CANNOT_WRITE_AFTER_END_OF_BUFFER);
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ ReturnType readFloatTextFastImpl(T & x, ReadBuffer & in)
|
|||||||
if (unlikely(read_digits > significant_digits))
|
if (unlikely(read_digits > significant_digits))
|
||||||
{
|
{
|
||||||
int before_point_additional_exponent = read_digits - significant_digits;
|
int before_point_additional_exponent = read_digits - significant_digits;
|
||||||
x = shift10(before_point, before_point_additional_exponent);
|
x = static_cast<T>(shift10(before_point, before_point_additional_exponent));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -411,10 +411,10 @@ ReturnType readFloatTextFastImpl(T & x, ReadBuffer & in)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (after_point)
|
if (after_point)
|
||||||
x += shift10(after_point, after_point_exponent);
|
x += static_cast<T>(shift10(after_point, after_point_exponent));
|
||||||
|
|
||||||
if (exponent)
|
if (exponent)
|
||||||
x = shift10(x, exponent);
|
x = static_cast<T>(shift10(x, exponent));
|
||||||
|
|
||||||
if (negative)
|
if (negative)
|
||||||
x = -x;
|
x = -x;
|
||||||
@ -486,7 +486,7 @@ ReturnType readFloatTextSimpleImpl(T & x, ReadBuffer & buf)
|
|||||||
bool negative = false;
|
bool negative = false;
|
||||||
x = 0;
|
x = 0;
|
||||||
bool after_point = false;
|
bool after_point = false;
|
||||||
double power_of_ten = 1;
|
T power_of_ten = 1;
|
||||||
|
|
||||||
if (buf.eof())
|
if (buf.eof())
|
||||||
throwReadAfterEOF();
|
throwReadAfterEOF();
|
||||||
|
@ -224,7 +224,7 @@ ProcessList::EntryPtr ProcessList::insert(const String & query_, const IAST * as
|
|||||||
}
|
}
|
||||||
|
|
||||||
thread_group->memory_tracker.setDescription("(for query)");
|
thread_group->memory_tracker.setDescription("(for query)");
|
||||||
if (settings.memory_tracker_fault_probability)
|
if (settings.memory_tracker_fault_probability > 0.0)
|
||||||
thread_group->memory_tracker.setFaultProbability(settings.memory_tracker_fault_probability);
|
thread_group->memory_tracker.setFaultProbability(settings.memory_tracker_fault_probability);
|
||||||
|
|
||||||
thread_group->memory_tracker.setOvercommitWaitingTime(settings.memory_usage_overcommit_max_wait_microseconds);
|
thread_group->memory_tracker.setOvercommitWaitingTime(settings.memory_usage_overcommit_max_wait_microseconds);
|
||||||
|
@ -262,7 +262,7 @@ Pipe SortedBlocksWriter::streamFromFile(const TmpFilePtr & file) const
|
|||||||
|
|
||||||
Block SortedBlocksBuffer::exchange(Block && block)
|
Block SortedBlocksBuffer::exchange(Block && block)
|
||||||
{
|
{
|
||||||
static constexpr const float reserve_coef = 1.2;
|
static constexpr const double reserve_coefficient = 1.2;
|
||||||
|
|
||||||
Blocks out_blocks;
|
Blocks out_blocks;
|
||||||
Block empty_out = block.cloneEmpty();
|
Block empty_out = block.cloneEmpty();
|
||||||
@ -282,7 +282,7 @@ Block SortedBlocksBuffer::exchange(Block && block)
|
|||||||
|
|
||||||
/// Not saved. Return buffered.
|
/// Not saved. Return buffered.
|
||||||
out_blocks.swap(buffer);
|
out_blocks.swap(buffer);
|
||||||
buffer.reserve(out_blocks.size() * reserve_coef);
|
buffer.reserve(static_cast<size_t>(out_blocks.size() * reserve_coefficient));
|
||||||
current_bytes = 0;
|
current_bytes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,45 +105,45 @@ static void insertNumber(IColumn & column, WhichDataType type, T value)
|
|||||||
switch (type.idx)
|
switch (type.idx)
|
||||||
{
|
{
|
||||||
case TypeIndex::UInt8:
|
case TypeIndex::UInt8:
|
||||||
assert_cast<ColumnUInt8 &>(column).insertValue(value);
|
assert_cast<ColumnUInt8 &>(column).insertValue(static_cast<UInt8>(value));
|
||||||
break;
|
break;
|
||||||
case TypeIndex::Date: [[fallthrough]];
|
case TypeIndex::Date: [[fallthrough]];
|
||||||
case TypeIndex::UInt16:
|
case TypeIndex::UInt16:
|
||||||
assert_cast<ColumnUInt16 &>(column).insertValue(value);
|
assert_cast<ColumnUInt16 &>(column).insertValue(static_cast<UInt16>(value));
|
||||||
break;
|
break;
|
||||||
case TypeIndex::DateTime: [[fallthrough]];
|
case TypeIndex::DateTime: [[fallthrough]];
|
||||||
case TypeIndex::UInt32:
|
case TypeIndex::UInt32:
|
||||||
assert_cast<ColumnUInt32 &>(column).insertValue(value);
|
assert_cast<ColumnUInt32 &>(column).insertValue(static_cast<UInt32>(value));
|
||||||
break;
|
break;
|
||||||
case TypeIndex::UInt64:
|
case TypeIndex::UInt64:
|
||||||
assert_cast<ColumnUInt64 &>(column).insertValue(value);
|
assert_cast<ColumnUInt64 &>(column).insertValue(static_cast<UInt64>(value));
|
||||||
break;
|
break;
|
||||||
case TypeIndex::Int8:
|
case TypeIndex::Int8:
|
||||||
assert_cast<ColumnInt8 &>(column).insertValue(value);
|
assert_cast<ColumnInt8 &>(column).insertValue(static_cast<Int8>(value));
|
||||||
break;
|
break;
|
||||||
case TypeIndex::Int16:
|
case TypeIndex::Int16:
|
||||||
assert_cast<ColumnInt16 &>(column).insertValue(value);
|
assert_cast<ColumnInt16 &>(column).insertValue(static_cast<Int16>(value));
|
||||||
break;
|
break;
|
||||||
case TypeIndex::Int32:
|
case TypeIndex::Int32:
|
||||||
assert_cast<ColumnInt32 &>(column).insertValue(value);
|
assert_cast<ColumnInt32 &>(column).insertValue(static_cast<Int32>(value));
|
||||||
break;
|
break;
|
||||||
case TypeIndex::Int64:
|
case TypeIndex::Int64:
|
||||||
assert_cast<ColumnInt64 &>(column).insertValue(value);
|
assert_cast<ColumnInt64 &>(column).insertValue(static_cast<Int64>(value));
|
||||||
break;
|
break;
|
||||||
case TypeIndex::Float32:
|
case TypeIndex::Float32:
|
||||||
assert_cast<ColumnFloat32 &>(column).insertValue(value);
|
assert_cast<ColumnFloat32 &>(column).insertValue(static_cast<Float32>(value));
|
||||||
break;
|
break;
|
||||||
case TypeIndex::Float64:
|
case TypeIndex::Float64:
|
||||||
assert_cast<ColumnFloat64 &>(column).insertValue(value);
|
assert_cast<ColumnFloat64 &>(column).insertValue(static_cast<Float64>(value));
|
||||||
break;
|
break;
|
||||||
case TypeIndex::Decimal32:
|
case TypeIndex::Decimal32:
|
||||||
assert_cast<ColumnDecimal<Decimal32> &>(column).insertValue(value);
|
assert_cast<ColumnDecimal<Decimal32> &>(column).insertValue(static_cast<Decimal32>(value));
|
||||||
break;
|
break;
|
||||||
case TypeIndex::Decimal64:
|
case TypeIndex::Decimal64:
|
||||||
assert_cast<ColumnDecimal<Decimal64> &>(column).insertValue(value);
|
assert_cast<ColumnDecimal<Decimal64> &>(column).insertValue(static_cast<Decimal64>(value));
|
||||||
break;
|
break;
|
||||||
case TypeIndex::DateTime64:
|
case TypeIndex::DateTime64:
|
||||||
assert_cast<ColumnDecimal<DateTime64> &>(column).insertValue(value);
|
assert_cast<ColumnDecimal<DateTime64> &>(column).insertValue(static_cast<DateTime64>(value));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw Exception("Type is not compatible with Avro", ErrorCodes::ILLEGAL_COLUMN);
|
throw Exception("Type is not compatible with Avro", ErrorCodes::ILLEGAL_COLUMN);
|
||||||
|
@ -20,7 +20,7 @@ struct Estimator
|
|||||||
{
|
{
|
||||||
double current_score = sum_size;
|
double current_score = sum_size;
|
||||||
|
|
||||||
if (!min_score || current_score < min_score)
|
if (min_score == 0.0 || current_score < min_score)
|
||||||
{
|
{
|
||||||
min_score = current_score;
|
min_score = current_score;
|
||||||
best_begin = begin;
|
best_begin = begin;
|
||||||
@ -33,7 +33,7 @@ struct Estimator
|
|||||||
return LevelMergeSelector::PartsRange(best_begin, best_end);
|
return LevelMergeSelector::PartsRange(best_begin, best_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
double min_score = 0;
|
double min_score = 0.0;
|
||||||
Iterator best_begin {};
|
Iterator best_begin {};
|
||||||
Iterator best_end {};
|
Iterator best_end {};
|
||||||
};
|
};
|
||||||
|
@ -36,7 +36,7 @@ struct Estimator
|
|||||||
while (end >= begin + 3 && (end - 1)->size < settings.heuristic_to_remove_small_parts_at_right_max_ratio * sum_size)
|
while (end >= begin + 3 && (end - 1)->size < settings.heuristic_to_remove_small_parts_at_right_max_ratio * sum_size)
|
||||||
--end;
|
--end;
|
||||||
|
|
||||||
if (!min_score || current_score < min_score)
|
if (min_score == 0.0 || current_score < min_score)
|
||||||
{
|
{
|
||||||
min_score = current_score;
|
min_score = current_score;
|
||||||
best_begin = begin;
|
best_begin = begin;
|
||||||
@ -69,7 +69,7 @@ struct Estimator
|
|||||||
return (sum_size + sum_size_fixed_cost * count) / (count - 1.9);
|
return (sum_size + sum_size_fixed_cost * count) / (count - 1.9);
|
||||||
}
|
}
|
||||||
|
|
||||||
double min_score = 0;
|
double min_score = 0.0;
|
||||||
Iterator best_begin {};
|
Iterator best_begin {};
|
||||||
Iterator best_end {};
|
Iterator best_end {};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user