Skip to content

Commit

Permalink
apply fixes for llvm (#3640)
Browse files Browse the repository at this point in the history
  • Loading branch information
SchrodingerZhu authored Dec 13, 2021
1 parent f1060c7 commit 560184c
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 218 deletions.
53 changes: 0 additions & 53 deletions dbms/src/DataStreams/PKColumnIterator.hpp

This file was deleted.

81 changes: 0 additions & 81 deletions dbms/src/DataStreams/RangesFilterBlockInputStream.cpp

This file was deleted.

41 changes: 0 additions & 41 deletions dbms/src/DataStreams/RangesFilterBlockInputStream.h

This file was deleted.

3 changes: 3 additions & 0 deletions dbms/src/Debug/dbgFuncMockRaftSnapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ struct MockSSTReader
struct Data : std::vector<std::pair<std::string, std::string>>
{
Data(const Data &) = delete;
Data & operator=(const Data &) = delete;
Data(Data &&) = default;
Data & operator=(Data &&) = default;
Data() = default;
};

Expand Down
11 changes: 6 additions & 5 deletions dbms/src/Functions/FunctionsConversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -1926,11 +1926,12 @@ struct ToIntMonotonicity
if (checkDataType<DataTypeFloat32>(&type)
|| checkDataType<DataTypeFloat64>(&type))
{
Float64 left_float = left.get<Float64>();
Float64 right_float = right.get<Float64>();

if (left_float >= std::numeric_limits<T>::min() && left_float <= std::numeric_limits<T>::max()
&& right_float >= std::numeric_limits<T>::min() && right_float <= std::numeric_limits<T>::max())
auto left_float = left.get<Float64>();
auto right_float = right.get<Float64>();
auto float_min = static_cast<Float64>(std::numeric_limits<T>::min());
auto float_max = static_cast<Float64>(std::numeric_limits<T>::max());
if (left_float >= float_min && left_float <= float_max
&& right_float >= float_min && right_float <= float_max)
return {true};

return {};
Expand Down
11 changes: 7 additions & 4 deletions dbms/src/Functions/FunctionsTiDBConversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,13 @@ struct TiDBConvertToInteger
return static_cast<ToFieldType>(0);
return static_cast<ToFieldType>(rounded_value);
}
if (rounded_value > std::numeric_limits<ToFieldType>::max())
auto field_max = static_cast<T>(std::numeric_limits<ToFieldType>::max());
if (rounded_value > field_max)
{
context.getDAGContext()->handleOverflowError("Cast real as integer", Errors::Types::Truncated);
return std::numeric_limits<ToFieldType>::max();
}
else if (rounded_value == std::numeric_limits<ToFieldType>::max())
else if (rounded_value == field_max)
{
context.getDAGContext()->handleOverflowError("cast real as int", Errors::Types::Truncated);
return std::numeric_limits<ToFieldType>::max();
Expand All @@ -276,12 +277,14 @@ struct TiDBConvertToInteger
static std::enable_if_t<std::is_floating_point_v<T>, ToFieldType> toInt(const T & value, const Context & context)
{
T rounded_value = std::round(value);
if (rounded_value < std::numeric_limits<ToFieldType>::min())
auto field_min = static_cast<T>(std::numeric_limits<ToFieldType>::min());
auto field_max = static_cast<T>(std::numeric_limits<ToFieldType>::max());
if (rounded_value < field_min)
{
context.getDAGContext()->handleOverflowError("cast real as int", Errors::Types::Truncated);
return std::numeric_limits<ToFieldType>::min();
}
if (rounded_value >= std::numeric_limits<ToFieldType>::max())
if (rounded_value >= field_max)
{
context.getDAGContext()->handleOverflowError("cast real as int", Errors::Types::Truncated);
return std::numeric_limits<ToFieldType>::max();
Expand Down
8 changes: 8 additions & 0 deletions dbms/src/Interpreters/Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@
#include <Interpreters/Settings.h>
#include <Interpreters/TimezoneInfo.h>
#include <common/MultiVersion.h>

#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#include <grpc++/grpc++.h>
#pragma clang diagnostic pop
#else
#include <grpc++/grpc++.h>
#endif

#include <chrono>
#include <condition_variable>
Expand Down
Loading

0 comments on commit 560184c

Please sign in to comment.