flink sql window api

时间:2017-06-08 04:36:31

标签: apache-flink flink-streaming

我尝试使用flink sql window api: https://ci.apache.org/projects/flink/flink-docs-release-1.3/dev/table_api.html#group-windows

StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
StreamTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env);

// ingest a DataStream from an external source
DataStream<Tuple3<Long, String, Integer>> ds = env.addSource(...);
// register the DataStream as table "Orders"
tableEnv.registerDataStream("Orders", ds, "user, product, amount");

// compute SUM(amount) per day (in event-time)
Table result1 = tableEnv.sql(
  "SELECT user, " +
  "  TUMBLE_START(rowtime(), INTERVAL '1' DAY) as wStart,  " +
  "  SUM(amount) FROM Orders " + 
  "GROUP BY TUMBLE(rowtime(), INTERVAL '1' DAY), user");

显示错误:

  

找不到功能签名rowtime()

的匹配项

请给我一个关于flink-sql-window api和rowtime.Thx的更详细的例子。

1 个答案:

答案 0 :(得分:1)

目前,文档有点不同步,但社区正在另一个分支中进行处理。 Flink 1.3引入了所谓的&#34;时间属性&#34;为了在将来更明确地访问,表达和使用时间。

您可以在current documentation draft中找到更多信息。可以在here找到一些如何在表程序中使用时间属性的示例。