如何在Kinesis Analytics SQL中添加列?

时间:2019-07-24 00:14:27

标签: sql amazon-kinesis kinesis amazon-kinesis-analytics-sql amazon-kinesis-analytics

我正在编写Kinesis Analytics SQL查询。我想向每行添加一个一致的字符串。 (对于整个表,它将添加具有相同值的列)。我的查询如下:

CREATE OR REPLACE STREAM "DESTINATION_SQL_STREAM1"(
APPLICATION_KEY VARCHAR(32),
CAMPAIGN_ID VARCHAR(8),
KPI_RESULT INTEGER,
KPI_TIME TIMESTAMP);

CREATE OR REPLACE PUMP "STREAM_PUMP1" AS INSERT INTO "DESTINATION_SQL_STREAM1"

SELECT STREAM APPLICATION_KEY,
CAMPAIGN_ID,

COUNT(*) AS KPI_RESULT,
STEP(TO_TIMESTAMP("SOURCE_SQL_STREAM_001".ARRIVAL_TIMESTAMP) BY INTERVAL '5' SECOND) AS KPI_TIME
FROM "SOURCE_SQL_STREAM_001"
WHERE EVENT_TYPE = '_campaign.send' AND CAMPAIGN_SEND_STATUS <> 'HOLDOUT'
GROUP BY APPLICATION_KEY,
CAMPAIGN_ID,
STEP(TO_TIMESTAMP("SOURCE_SQL_STREAM_001".ARRIVAL_TIMESTAMP) BY INTERVAL '5' SECOND),
FLOOR(("SOURCE_SQL_STREAM_001".ROWTIME - TIMESTAMP '1970-01-01 00:00:00') SECOND / 5 TO SECOND);

我使用滚动窗口获取结果。我想添加一个名为“ KPI_type”的列,其值为“ KPI1”。我想尝试“更改”方法。但是我无法在查询中找到合适的位置来添加此语句。有谁知道在这种情况下如何添加列或使用“更改”?谢谢!

0 个答案:

没有答案