1

In the documentation provided by AWS they provide examples for doing tumbling and sliding windows based on the ROWTIME which is the timestamp when Amazon Kinesis Analytics inserted the row in the first in-application stream.

The provided example:

Tumbling window

GROUP BY Ticker_Symbol, 
         STEP("INCOMING_STREAM".ROWTIME BY INTERVAL '60' SECOND);

I want to use my own timestamp for doing this windowing. In my case the field is called "recordTimeStamp".

I defined it as a timestamp:

CREATE OR REPLACE STREAM "INCOMING_STREAM" (
    "uniqueId" INTEGER,
    "speed" INTEGER,
    "bezettingsgraad" INTEGER,
    "recordTimestamp" TIMESTAMP);

When looking at the "INCOMING_STREAM" I see the timestamp formag eg. 2020-05-03 20:18:36.0.

However, when rewriting above statements to work with my own "recordTimestamp" I get the message:

Cannot aggregate an infinite stream: GROUP BY clause is not specified or does not contain any monotonic expressions.

Tumbling window

GROUP BY Ticker_Symbol, 
         STEP("INCOMING_STREAM"."recordTimestamp" BY INTERVAL '60' SECOND);

How can I fix this or perhaps indicate that my "recordTimestamp" field is monotonicly increaing

xtra
  • 1,957
  • 4
  • 22
  • 40

1 Answers1

0

I never used it myself, but there is a MONOTONIC function in the SQL reference that seems to be what you are looking for:

The MONOTONIC function allows you to declare that a given expression is monotonic, enabling a streaming GROUP BY to use that expression as a key.

bcandrea
  • 64
  • 5