我想在java中使用Cassandra / spark Connector从Cassandra中检索数据。表中的某些值为null。我用
JavaRDD<String> rdd = javaFunctions(sc).cassandraTable("test", "Sportman", Sportman.class)
.map(new org.apache.spark.api.java.function.Function<Sportman, String>() {
@Override
public String call(Sportman person) throws Exception {
return person.toString();
}
});
尝试运行程序时出现此错误。
TypeConversionException:无法将表test.Sportman完成的列转换为java.lang.Boolean:null
我定义Sportman类是这样的:
public static class Sportman implements Serializable{
private UUID rowid;
private Boolean accomplished;
public Sportman(){}
public UUID getRowid() {
return rowid;
}
public void setRowid(UUID rowid) {
this.rowid = rowid;
}
public Boolean getAccomplished() {
return accomplished;
}
public void setAccomplished(Boolean accomplished) {
this.accomplished = accomplished;
}
我不知道如何更改get方法来修复此错误。任何帮助将不胜感激。