如何在Kinesis SQL查询中正确包含时间戳?

时间:2019-07-25 08:31:33

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

以下Kinesis SQL片段旨在为Elastic Search生成输入:

CREATE OR REPLACE STREAM "DESTINATION_SQL_STREAM" ("sensorId" VARCHAR(8), "timestamp" VARCHAR(128), "sidcount" INTEGER, "temperature_stddev" FLOAT);

CREATE OR REPLACE PUMP "STREAM_PUMP" AS INSERT INTO "DESTINATION_SQL_STREAM"

SELECT STREAM "sensorId",  
  TIMESTAMP_TO_CHAR('yyyy-MM-DD hh:mm:ss', "timestampUTC") as "timestamp", 
  COUNT(*) OVER TEN_SECOND_SLIDING_WINDOW AS "sidcount", 
  STDDEV_SAMP("temperature") 
  OVER TEN_SECOND_SLIDING_WINDOW AS "temperature_stddev"
    FROM "SOURCE_SQL_STREAM_001"
    WINDOW TEN_SECOND_SLIDING_WINDOW AS (
      PARTITION BY "sensorId"
      RANGE INTERVAL '1' MINUTE PRECEDING);

预期的行为是:在“ Amazon Kinesis Analytics”中生成一些示例结果

实际行为是:未显示任何结果,消息“尚未到达行”。

删除STDDEV_SAMP("temperature") OVER TEN_SECOND_SLIDING_WINDOW AS "temperature_stddev"可以解决问题,但这对我来说是不可接受的

非常感谢您的建议!

0 个答案:

没有答案