其他分享
首页 > 其他分享> > flink keyBy报错

flink keyBy报错

作者:互联网

flink 执行keyBy操作出现异常情况:

Exception in thread "main" org.apache.flink.api.common.InvalidProgramException: This type (GenericType<com.hmh.entity.SensorEntity>) 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:340)
at com.hmh.action.OperationActionTest1.main(OperationActionTest1.java:38)

 

javabean

@Data
@AllArgsConstructor
public class SensorEntity {

private String id ;
private long time;
private double tmpeature;

}

 

解决:新增无参数的构造函数

@Data
@AllArgsConstructor
@NoArgsConstructor
public class SensorEntity {

private String id ;
private long time;
private double tmpeature;

}

 

标签:keyBy,java,flink,private,报错,apache,org
来源: https://www.cnblogs.com/kgv5/p/14696160.html