I use Scala to connect to Cassandra and apply my queries in it, I created a simple table in Cassandra that has two columns row_id and row_values. row_id has a data type like "varchar", and row_values stores a list of items. I inserted some random values into the table and want to get them. To create a table:
CREATE TABLE Matrix1(row_id VARCHAR PRIMARY KEY, row_values LIST<VARCHAR>);
Insert to table:
INSERT INTO Matrix1(row_id, row_values) VALUES ('abcd3', ['dsf23', 'fsf1','dsdf1']);
Now I want to get the values and print them using Scala, I use the code to save the values from the query
val results: ResultSet = session.execute("SELECT * FROM Matrix1 where row_id = 'abcd3'")
Now I want to print "row_id" and "row_values"
var rowid: String = null
var rowval: List[String] = null
for (row <- results) {
rowid = row.getString("row_id")
rowval = row.getList("row_values")
}
with this code, I get the values in "rowid" because it is String, but there is an error for "rowval". How can I get a column (list type) from a ResultSet?