cassandra Spark连接器-使用元组列表时无法获取数据

7eumitmz  于 2022-11-23  发布在  Cassandra
关注(0)|答案(1)|浏览(137)

我的JavaBean定义如下

public class LiveResultsFrmCassandra implements Serializable{

    UUID id;

    String userdn;
    String queryid;

    private List<Tuple4<String, String, String, String>> docList = new ArrayList();

    public LiveResultsFrmCassandra() {
    }

    public UUID getId() {
        return id;
    }

    public String getUserdn() {
        return userdn;
    }

    public String getQueryid() {
        return queryid;
    }

    public void setId(UUID id) {
        this.id = id;
    }

    public void setUserdn(String userdn) {
        this.userdn = userdn;
    }

    public void setQueryid(String queryid) {
        this.queryid = queryid;
    }

    public List<Tuple4<String, String, String, String>> getDocList() {
        return docList;
    }

    public void setDocList(List<Tuple4<String, String, String, String>> docList) {
        this.docList = docList;
    }
}

我有下面的代码来使用Spark连接器读取数据,

JavaRDD<LiveResultsFrmCassandra> resultsRDD = javaFunctions(sparkContext).cassandraTable(mf.getConfig().getDatabaseName(), LIVERESULTS, mapRowTo(LiveResultsFrmCassandra.class));

我的表定义如下

CREATE TABLE IF NOT EXISTS LiveResults (
 id uuid PRIMARY KEY,
 doclist list<frozen<tuple<text, text, text, text>>>,
 queryid text,
 userdn text );

我看到数据进入其他字段,但我没有得到docList的数据。有人看到过同样的行为吗?

kjthegm6

kjthegm61#

docklist和getter以及setter使用小写,如下所示。

List<Tuple4<String, String, String, String>> doclist =  new ArrayList();

public List<Tuple4<String, String, String, String>> getDoclist() {
    return doclist;
}

public void setDoclist(List<Tuple4<String, String, String, String>> doclist) {
    this.doclist = doclist;
}

相关问题