美文网首页
关于Flink报错的问题

关于Flink报错的问题

作者: 和平菌 | 来源:发表于2019-04-23 11:22 被阅读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类型的属性

    相关文章

      网友评论

          本文标题:关于Flink报错的问题

          本文链接:https://www.haomeiwen.com/subject/wbamgqtx.html