Skip to content

Instantly share code, notes, and snippets.

@Nxtra
Created Jul 22, 2020
Embed
What would you like to do?
CREATE OR REPLACE PUMP "STREAM_PUMP_SPEED" AS
INSERT INTO "SPEED_SQL_STREAM"
SELECT STREAM
"uniqueId",
AVG("speed") over W0,
AVG("speed") over W2,
AVG("speed") over W10
FROM "INCOMING_STREAM"
WINDOW
W0 AS ( PARTITION BY "uniqueId"
RANGE INTERVAL '0' MINUTE PRECEDING),
W2 AS ( PARTITION BY "uniqueId"
RANGE INTERVAL '2' MINUTE PRECEDING),
W10 AS ( PARTITION BY "uniqueId"
RANGE INTERVAL '10' MINUTE PRECEDING);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment