I've read the definition here https://docs.aws.amazon.com/kinesisanalytics/latest/sqlref/sql-reference-monotonic-expressions-operators.html, however it's still unclear to me. I understand that monotonic means ascending or descending. Does that mean that a monotonic column is ascending, descending, strictly ascending, or strictly descending? Does it have to be unique or can it contain duplicates?
The context of this question is that I tried use an ORDER BY
in a WINDOW
based on a TIMESTAMP
, but I got the error The leading column of an ORDER BY statement must be monotonic
(which I thought TIMESTAMPS were).
Example:
WINDOW fifteenSecondWindow as (
PARTITION BY "peerId" (none unique)
ORDER BY "emissionTime" (is unique for each partition of peers, but may not be globally unique)
RANGE INTERVAL '15' SECOND PRECEDING
);
Monotonic in mathematics means that a each value of a sequence is either strictly greater than or equal to or less than or equal to the preceding value.
The notion of "monotonicity" is that ordering of the "x" values is preserved for the results of the function.
If you relax the equality, then the sequence is either strictly increasing or strictly decreasing.
I would expect this terminology to be standard wherever the term is used. So, duplicates are allowed.