Created
August 25, 2017 16:44
-
-
Save stephendeyoung/5d87c5ac1bdfca436eb1076359a6034d to your computer and use it in GitHub Desktop.
This file contains hidden or 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" ( | |
entity_id VARCHAR(64), | |
avg_power DOUBLE); | |
CREATE OR REPLACE PUMP "STREAM_PUMP" AS INSERT INTO "DESTINATION_SQL_STREAM" | |
SELECT STREAM | |
entity_id, | |
AVG(active_power) OVER secs_window | |
FROM "SOURCE_SQL_STREAM_001" | |
WINDOW | |
secs_window AS (PARTITION BY entity_id RANGE INTERVAL '5' SECOND PRECEDING) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment