MoneyPenny
MoneyPenny

Reputation: 71

How to get nested map from Cassandra Result Set

I have a Cassandra table like this:

create table Engine (
    primayval text,
    Dataval  map<text,<map<text, double>>,
    PRIMARY KEY (tradeddate)
);

How can I retrieve this in a Java nested map Map<String,Map<String,Double>> using ResultSet-> getMap() without JSON conversion?

Upvotes: 3

Views: 1197

Answers (1)

MoneyPenny
MoneyPenny

Reputation: 71

turned out to be quite straightforward :

    Map<String, Map<String,Double>> DataVal;
    Row rw = resultSet.one();
    DataVal=(rw.getMap("DataVal", TypeToken.of(String.class),new TypeToken<Map<String,Double>>() {}));

Upvotes: 3

Related Questions