Last active
March 26, 2019 13:32
-
-
Save mcroissant/d6f10f2c0728ec4d1fa8915554f11bca to your computer and use it in GitHub Desktop.
Iot Kinesis SQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE STREAM "DESTINATION_SQL_STREAM" (time_stamp bigint, mean_value double); | |
CREATE OR REPLACE PUMP "STREAM_PUMP" AS INSERT INTO "DESTINATION_SQL_STREAM" | |
SELECT STREAM | |
MAX("COL_timestamp") OVER TEN_SECOND_SLIDING_WINDOW as time_stamp, | |
AVG(cast("v" as double)) OVER TEN_SECOND_SLIDING_WINDOW AS mean_value | |
FROM "SOURCE_SQL_STREAM_001" | |
WHERE "id" = 'Simulation Examples.Functions.Sine4' | |
WINDOW TEN_SECOND_SLIDING_WINDOW AS ( | |
PARTITION BY "COL_timestamp" | |
RANGE INTERVAL '10' SECOND PRECEDING); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment