Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

To use these functions, the Interval Feature is required.

The interval feature provides arbitrary functions to work with intervals in a data stream and algebraic operator (+, *, -, /, ^) to perform interval addition, subtraction, multiplication, division, and exponentiation.

Code Block
languagesql
titleExample
SELECT toInterval(1.0,5.0) + toInterval(-2.0,3.0) FROM stream
=> [-1.0,8.0]
SELECT toInterval(1.0,5.0) - toInterval(-2.0,3.0) FROM stream
=> [-2.0,7.0]
SELECT toInterval(1.0,5.0) * toInterval(-2.0,3.0) FROM stream
=> [-10.0,15.0]
SELECT toInterval(1.0,5.0) / toInterval(-2.0,3.0) FROM stream
=> [-2.5,Infinity]

Union(Interval, Interval)

Computes the union of the two intervals.

Code Block
languagesql
titleExample
SELECT union(toInterval(1.0,5.0), toInterval(-2.0,3.0)) FROM stream
=> [-2.0,5.0]

Difference(Interval, Interval)

Computes the difference of the two intervals

Code Block
languagesql
titleExample
SELECT difference(toInterval(1.0,5.0), toInterval(-2.0,3.0)) FROM stream
=> [3.0,5.0]

Intersection(Interval, Interval)

Computes the intersection of the two intervals

Code Block
languagesql
titleExample
SELECT intersection(toInterval(1.0,5.0), toInterval(-2.0,3.0)) FROM stream
=> [1.0,3.0]

ToInterval(Number, Number)

Converts the given value to an interval value.

Table of Contents