Fix UBSan report in TransformDateTime64

This commit is contained in:
Alexey Milovidov 2021-03-24 02:49:17 +03:00
parent 4de5afed4e
commit 47b00ad11b
3 changed files with 8 additions and 1 deletions

View File

@ -49,8 +49,11 @@ public:
{}
template <typename ... Args>
inline auto execute(const DateTime64 & t, Args && ... args) const
inline auto NO_SANITIZE_UNDEFINED execute(const DateTime64 & t, Args && ... args) const
{
/// Type conversion from float to integer may be required.
/// We are Ok with implementation specific result for out of range and denormals conversion.
if constexpr (TransformHasExecuteOverload_v<DateTime64, decltype(scale_multiplier), Args...>)
{
return wrapped_transform.execute(t, scale_multiplier, std::forward<Args>(args)...);

View File

@ -0,0 +1,2 @@
0
0

View File

@ -0,0 +1,2 @@
-- The result is unspecified but UBSan should not argue.
SELECT ignore(addHours(now64(3), inf)) FROM numbers(2);