能发一下具体的异常栈吗?是哪个版本?

yanyunpeng <yanyunp...@rockontrol.com> 于2021年8月4日周三 下午2:47写道:

> Table table = tableEnv
>  .from("t_yyp_test")
>  .window(Over.partitionBy($("f_h"), $("f_l"), $("f_j"))
>  .orderBy($("f_time"))
>  .preceding("unbounded_range")
>  .following(CURRENT_RANGE)
>  .as("w"))
>  .select($("f_value"),
>  $("f_h"),
>  $("f_l"),
>  $("f_j"),
>  $("f_value").avg().over($("w")),
>  $("f_value").varPop().over($("w")),
>  $("f_value").stddevPop().over($("w")));
> 也是一样的
> Exception in thread "main" org.apache.flink.table.api.ValidationException:
> Ordering must be defined on a time attribute.
>
> 在 2021年8月4日 14:34,Caizhi Weng<tsreape...@gmail.com> 写道:
>
>
> Hi! order by 的字段是 f_time_bak,但是 watermark 的字段是 f_time,这两个不一致。 yanyunpeng <
> yanyunp...@rockontrol.com> 于2021年8月4日周三 下午2:30写道: > 代码如下: >
> EnvironmentSettings bbSettings = >
> EnvironmentSettings.newInstance().useBlinkPlanner().inBatchMode().build();
> > TableEnvironment tableEnv = TableEnvironment.create(bbSettings); >
> tableEnv.executeSql("CREATE TABLE t_yyp_test (\n" + > " f_id INT,\n" + > "
> f_h STRING,\n" + > " f_l STRING,\n" + > " f_j STRING,\n" + > " f_value
> DOUBLE,\n" + > " f_time TIMESTAMP(3)\n, " + > " f_time_bak TIMESTAMP(3)\n,
> " + > " PRIMARY KEY (f_id) NOT ENFORCED,\n" + > " WATERMARK FOR f_time AS
> f_time \n" + > ") WITH (\n" + > " 'connector' = 'jdbc',\n" + > " 'url' =
> 'jdbc:mysql://***',\n" + > " 'table-name' = '123',\n" + > " 'username' =
> '123',\n" + > " 'password' = '123'\n" + > ")"); >
> tableEnv.registerFunction("GaussianFunction", new GaussianFunction()); >
> Table table = tableEnv > .from("t_yyp_test") >
> .window(Over.partitionBy($("f_h"), $("f_l"), $("f_j")) >
> .orderBy($("f_time_bak")) > .preceding("unbounded_range") >
> .following(CURRENT_RANGE) > .as("w")) > .select($("f_h"), > $("f_l"), >
> $("f_j"), > $("f_value").avg().over($("w")), >
> $("f_value").varPop().over($("w")), >
> $("f_value").stddevPop().over($("w"))); > > > 已经定义了eventTime
> 使用eventTIme或者别的时间字段排序都报错 > > > Exception in thread "main"
> org.apache.flink.table.api.ValidationException: > Ordering must be defined
> on a time attribute. > > > 请问这是什么原因

回复