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

How to store List(list(value)) in cassandra table?

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

我创建了 table 列

列表

这实际上应该自动工作,除非嵌套集合类型会导致冻结。

你试过了吗:

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>>>,这意味着你不能更新嵌套列表的内容,你只能更新整个列,但是你应该可以的。