Error in getting data that contains null from Cassandra database using Spark / Cassandra connector

I want to get data from Cassandra using Cassandra / spark Connector in java. Some of the values ​​in the table are zero. I use

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();
                }
            });

      

I got this error when trying to run the program.

TypeConversionException: Failed to convert column from table test.Sportman to java.lang.Boolean: null

I define the Sportman class as follows:

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;

    }

      

I don't know how to change the get method to fix this error. any help would be appreciated.

+3


source to share





All Articles