intervalLengthSum
Calculates the total length of union of all ranges (segments on numeric axis).
Syntax
Arguments
start— The starting value of the interval. Int32, Int64, UInt32, UInt64, Float32, Float64, DateTime or Date.end— The ending value of the interval. Int32, Int64, UInt32, UInt64, Float32, Float64, DateTime or Date.
Arguments must be of the same data type. Otherwise, an exception will be thrown.
Returned value
- Total length of union of all ranges (segments on numeric axis). Depending on the type of the argument, the return value may be UInt64 or Float64 type.
Examples
- Input table:
In this example, the arguments of the Float32 type are used. The function returns a value of the Float64 type.
Result is the sum of lengths of intervals [1.1, 3.2] (union of [1.1, 2.9] and [2.5, 3.2]) and [4, 5]
Query:
Result:
- Input table:
In this example, the arguments of the DateTime type are used. The function returns a value in seconds.
Query:
Result:
- Input table:
In this example, the arguments of the Date type are used. The function returns a value in days.
Query:
Result:
intervalLengthSum
Introduced in: v21.7
Takes multiple numeric ranges and calculates the total length when all overlapping parts are combined into a single unified range.
Arguments must be of the same data type. Otherwise, an exception will be thrown.
Syntax
Arguments
start— The starting value of the interval.(U)Int32/64orFloat*orDateTimeorDateend— The ending value of the interval.(U)Int32/64orFloat*orDateTimeorDate
Returned value
Returns the total length of union of all ranges (segments on numeric axis). Depending on the type of the argument, the return value may be UInt64 or Float64 type. UInt64 or Float64
Examples
Float32 example
DateTime example
Date example