mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Remove clamping from AddDaysImpl and AddWeeksImpl; fix 01921_datatype_date32 test
This commit is contained in:
parent
96598e3574
commit
537ba613dc
@ -288,12 +288,12 @@ struct AddDaysImpl
|
|||||||
|
|
||||||
static inline NO_SANITIZE_UNDEFINED UInt16 execute(UInt16 d, Int64 delta, const DateLUTImpl &, UInt16 = 0)
|
static inline NO_SANITIZE_UNDEFINED UInt16 execute(UInt16 d, Int64 delta, const DateLUTImpl &, UInt16 = 0)
|
||||||
{
|
{
|
||||||
return static_cast<UInt16>(std::clamp(d + delta, 0L, 65535L));
|
return d + delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline NO_SANITIZE_UNDEFINED Int32 execute(Int32 d, Int64 delta, const DateLUTImpl &, UInt16 = 0)
|
static inline NO_SANITIZE_UNDEFINED Int32 execute(Int32 d, Int64 delta, const DateLUTImpl &, UInt16 = 0)
|
||||||
{
|
{
|
||||||
return std::max(static_cast<Int32>(d + delta), -static_cast<Int32>(DateLUT::instance().getDayNumOffsetEpoch()));
|
return d + delta;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -322,12 +322,12 @@ struct AddWeeksImpl
|
|||||||
|
|
||||||
static inline NO_SANITIZE_UNDEFINED UInt16 execute(UInt16 d, Int32 delta, const DateLUTImpl &, UInt16 = 0)
|
static inline NO_SANITIZE_UNDEFINED UInt16 execute(UInt16 d, Int32 delta, const DateLUTImpl &, UInt16 = 0)
|
||||||
{
|
{
|
||||||
return static_cast<UInt16>(std::clamp(d + delta * 7, 0, 65535));
|
return d + delta * 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline NO_SANITIZE_UNDEFINED Int32 execute(Int32 d, Int32 delta, const DateLUTImpl &, UInt16 = 0)
|
static inline NO_SANITIZE_UNDEFINED Int32 execute(Int32 d, Int32 delta, const DateLUTImpl &, UInt16 = 0)
|
||||||
{
|
{
|
||||||
return std::max(static_cast<Int32>(d + delta * 7), -static_cast<Int32>(DateLUT::instance().getDayNumOffsetEpoch()));
|
return d + delta * 7;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -248,14 +248,14 @@
|
|||||||
2299-12-30 23:00:00.000
|
2299-12-30 23:00:00.000
|
||||||
2021-06-21 23:00:00.000
|
2021-06-21 23:00:00.000
|
||||||
-------subtractDays---------
|
-------subtractDays---------
|
||||||
1900-01-01
|
2299-12-31
|
||||||
1900-01-01
|
2299-12-31
|
||||||
2299-12-08
|
2299-12-08
|
||||||
2299-12-24
|
2299-12-24
|
||||||
2021-06-15
|
2021-06-15
|
||||||
-------subtractWeeks---------
|
-------subtractWeeks---------
|
||||||
1900-01-01
|
2299-12-31
|
||||||
1900-01-01
|
2299-12-31
|
||||||
2299-12-08
|
2299-12-08
|
||||||
2299-12-24
|
2299-12-24
|
||||||
2021-06-15
|
2021-06-15
|
||||||
|
Loading…
Reference in New Issue
Block a user