关于Flink报错的问题

2019-04-23  本文已影响0人  和平菌
GenericType<com.demo.SourceData>) cannot be used as key


其中model SourceData中有个属性是布尔类型

private boolean enable

详细报错如下

Caused by: org.apache.flink.api.common.InvalidProgramException: This type (GenericType<com.demo.SourceData>) cannot be used as key.
        at org.apache.flink.api.common.operators.Keys$ExpressionKeys.<init>(Keys.java:330)
        at org.apache.flink.streaming.api.datastream.DataStream.keyBy(DataStream.java:335)
        at com......Cache.main(StreamCache.java:65)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:529)
        ... 10 more

65行代码为
sourceDataStream.keyBy("biz").window(TumblingProcessingTimeWindows.of(Time.minutes(1)))

因本次改动只是在model上新增boolean类型的属性
故判断keyby的时候model不能有boolean类型的属性

上一篇下一篇

猜你喜欢

热点阅读