如何在cassandra表中存储List(list(value))?

时间:2018-05-21 18:24:54

标签: cassandra datastax cassandra-3.0 cqlsh phantom-dsl

如何在Cassandra表中的一列中存储List(List(1,2,3,4),List(1,2,3,0))值?

我创建了带有列的表

列表

1 个答案:

答案 0 :(得分:0)

这实际上应该可以自动工作,但嵌套的集合类型会导致冻结。

您是否尝试过:

case class Record(id: UUID, nested: List[List[Int]])

abstract class MyTable extends Table[MyTable, Record] {
  object id extends Col[UUID] with PartitionKey
  object nested extends Col[List[List[Int]]
}

执行此操作时,您会得到一个更加时髦的Cassandra类型,类型为nested list<frozen<list<int>>>,这意味着您无法更新嵌套列表的内容,只能更新整个列,但是应该能够做到。