Fix 7/8 of trash

This commit is contained in:
Alexey Milovidov 2022-09-11 04:49:43 +02:00
parent 91baedf03a
commit 42b0d444da
6 changed files with 23 additions and 18 deletions

View File

@ -165,8 +165,8 @@ class QuantileTDigest
{ {
l_mean += r->count * (r->mean - l_mean) / l_count; // Symmetric algo (M1*C1 + M2*C2)/(C1+C2) is numerically better, but slower l_mean += r->count * (r->mean - l_mean) / l_count; // Symmetric algo (M1*C1 + M2*C2)/(C1+C2) is numerically better, but slower
} }
l->mean = l_mean; l->mean = static_cast<Value>(l_mean);
l->count = l_count; l->count = static_cast<Value>(l_count);
batch_pos += 1; batch_pos += 1;
} }
else else
@ -252,8 +252,8 @@ public:
{ {
l_mean += r->count * (r->mean - l_mean) / l_count; // Symmetric algo (M1*C1 + M2*C2)/(C1+C2) is numerically better, but slower l_mean += r->count * (r->mean - l_mean) / l_count; // Symmetric algo (M1*C1 + M2*C2)/(C1+C2) is numerically better, but slower
} }
l->mean = l_mean; l->mean = static_cast<Value>(l_mean);
l->count = l_count; l->count = static_cast<Value>(l_count);
} }
else else
{ {
@ -369,7 +369,12 @@ public:
else if (x >= right) else if (x >= right)
return checkOverflow<ResultType>(c.mean); return checkOverflow<ResultType>(c.mean);
else else
return checkOverflow<ResultType>(interpolate(x, left, prev_mean, right, c.mean)); return checkOverflow<ResultType>(interpolate(
static_cast<Value>(x),
static_cast<Value>(left),
prev_mean,
static_cast<Value>(right),
c.mean));
} }
sum += c.count; sum += c.count;

View File

@ -617,7 +617,7 @@ void FlatDictionary::setAttributeValue(Attribute & attribute, const UInt64 key,
} }
else else
{ {
container[key] = static_cast<Type>(attribute_value); container[key] = static_cast<ValueType>(attribute_value);
} }
}; };

View File

@ -157,7 +157,7 @@ public:
switch (max_unit) /// A kind of Duff Device. switch (max_unit) /// A kind of Duff Device.
{ {
case Years: processUnit(365 * 24 * 3600, " year", 5, value, buf_to, has_output); [[fallthrough]]; case Years: processUnit(365 * 24 * 3600, " year", 5, value, buf_to, has_output); [[fallthrough]];
case Months: processUnit(30.5 * 24 * 3600, " month", 6, value, buf_to, has_output); [[fallthrough]]; case Months: processUnit(static_cast<UInt64>(30.5 * 24 * 3600), " month", 6, value, buf_to, has_output); [[fallthrough]];
case Days: processUnit(24 * 3600, " day", 4, value, buf_to, has_output); [[fallthrough]]; case Days: processUnit(24 * 3600, " day", 4, value, buf_to, has_output); [[fallthrough]];
case Hours: processUnit(3600, " hour", 5, value, buf_to, has_output); [[fallthrough]]; case Hours: processUnit(3600, " hour", 5, value, buf_to, has_output); [[fallthrough]];
case Minutes: processUnit(60, " minute", 7, value, buf_to, has_output); [[fallthrough]]; case Minutes: processUnit(60, " minute", 7, value, buf_to, has_output); [[fallthrough]];
@ -228,4 +228,3 @@ REGISTER_FUNCTION(FormatReadableTimeDelta)
} }
} }

View File

@ -101,7 +101,7 @@ private:
void processNotNullable(const InputData & input_data, ColumnUInt8::Container & result_data, size_t input_rows_count) const void processNotNullable(const InputData & input_data, ColumnUInt8::Container & result_data, size_t input_rows_count) const
{ {
for (size_t i = 0; i < input_rows_count; ++i) for (size_t i = 0; i < input_rows_count; ++i)
result_data[i] = !input_data[i]; result_data[i] = input_data[i] == 0;
} }
template <typename InputData> template <typename InputData>
@ -109,7 +109,7 @@ private:
ColumnUInt8::Container & result_data, size_t input_rows_count) const ColumnUInt8::Container & result_data, size_t input_rows_count) const
{ {
for (size_t i = 0; i < input_rows_count; ++i) for (size_t i = 0; i < input_rows_count; ++i)
result_data[i] = input_null_map[i] || !input_data[i]; result_data[i] = input_null_map[i] || input_data[i] == 0;
} }
}; };
@ -121,4 +121,3 @@ REGISTER_FUNCTION(IsZeroOrNull)
} }
} }

View File

@ -132,9 +132,9 @@ public:
year <= Traits::MAX_YEAR && year <= Traits::MAX_YEAR &&
month >= 1 && month <= 12 && month >= 1 && month <= 12 &&
day >= 1 && day <= 31 && day >= 1 && day <= 31 &&
YearMonthDayToSingleInt(year, month, day) <= Traits::MAX_DATE) YearMonthDayToSingleInt(static_cast<Int64>(year), static_cast<Int64>(month), static_cast<Int64>(day)) <= Traits::MAX_DATE)
{ {
day_num = date_lut.makeDayNum(year, month, day); day_num = date_lut.makeDayNum(static_cast<Int16>(year), static_cast<UInt8>(month), static_cast<UInt8>(day));
} }
result_data[i] = day_num; result_data[i] = day_num;
@ -205,7 +205,9 @@ protected:
if (unlikely(year > DATE_LUT_MAX_YEAR)) if (unlikely(year > DATE_LUT_MAX_YEAR))
return maxDateTime(lut); return maxDateTime(lut);
return lut.makeDateTime(year, month, day_of_month, hour, minute, second); return lut.makeDateTime(
static_cast<Int16>(year), static_cast<UInt8>(month), static_cast<UInt8>(day_of_month),
static_cast<UInt8>(hour), static_cast<UInt8>(minute), static_cast<UInt8>(second));
} }
static Int64 minDateTime(const DateLUTImpl & lut) static Int64 minDateTime(const DateLUTImpl & lut)
@ -394,7 +396,7 @@ public:
if (unlikely(date_time == min_date_time)) if (unlikely(date_time == min_date_time))
fraction = 0; fraction = 0;
else if (unlikely(date_time == max_date_time)) else if (unlikely(date_time == max_date_time))
fraction = 999999999ll; fraction = 999999999;
else else
{ {
fraction = fraction_data ? (*fraction_data)[i] : 0; fraction = fraction_data ? (*fraction_data)[i] : 0;
@ -409,7 +411,7 @@ public:
fraction = max_fraction; fraction = max_fraction;
} }
result_data[i] = DecimalUtils::decimalFromComponents<DateTime64>(date_time, fraction, precision); result_data[i] = DecimalUtils::decimalFromComponents<DateTime64>(date_time, static_cast<Int64>(fraction), precision);
} }
return res_column; return res_column;

View File

@ -395,7 +395,7 @@ private:
if (!out) if (!out)
return false; return false;
executeImplNumToNumWithConstDefault<T, U>(in->getData(), out->getData(), cache.const_default_value.get<U>()); executeImplNumToNumWithConstDefault<T, U>(in->getData(), out->getData(), static_cast<U>(cache.const_default_value.get<U>()));
return true; return true;
} }
@ -870,7 +870,7 @@ private:
if (it) if (it)
memcpy(&dst[i], &it->getMapped(), sizeof(dst[i])); /// little endian. memcpy(&dst[i], &it->getMapped(), sizeof(dst[i])); /// little endian.
else else
dst[i] = dst_default[i]; // NOLINT dst[i] = static_cast<U>(dst_default[i]);
} }
} }