**How to reproduce**
```
SELECT
    intervalLengthSum(10, 5) AS res,
    toInt64(res) AS cast,
    toTypeName(res) AS type

Query id: bc8307c2-a520-4499-959e-bb00e0bdf055

┌──────────────────res─┬─cast─┬─type───┐
│ 18446744073709551611 │   -5 │ UInt64 │
└──────────────────────┴──────┴────────┘
```
**Expected behavior**
intervals with negative sum will be converted to zero.
#include <unordered_set>
namespace DB
{
namespace ErrorCodes
{
    extern const int TOO_LARGE_ARRAY_SIZE;
}
/**
 * Calculate total length of intervals without intersections. Each interval is the pair of numbers [begin, end];
 * Return UInt64 for integral types (UInt/Int*, Date/DateTime) and return Float64 for Float*.
 *
 * Implementation simply stores intervals sorted by beginning and sums lengths at final.
 */
template <typename T>
struct AggregateFunctionIntervalLengthSumData
{
    constexpr static size_t MAX_ARRAY_SIZE = 0xFFFFFF;
    using Segment = std::pair<T, T>;
    using Segments = PODArrayWithStackMemory<Segment, 64>;
    bool sorted = false;
    Segments segments;
    void add(T begin, T end)
    {
        if (sorted && !segments.empty())
        {
            sorted = segments.back().first <= begin;
        }
        segments.emplace_back(begin, end);
    }
    void merge(const AggregateFunctionIntervalLengthSumData & other)