本文档列出了Cassandra 2.2的许多CQL限制.我在为收集限制特别感兴趣Set和List.如果我已正确解释它,该文档指出集合中的值限制为65535字节.
据我所知,这个限制是存在的,因为set identity是使用存储引擎单元的列名中的复合值实现的(类似于聚类列值限制),CQL限制为那么多字节.
考虑一个Set类似的表
CREATE TABLE test.bounds (
someid text,
someorder text,
words set<text>,
PRIMARY KEY (someid, someorder)
)
Run Code Online (Sandbox Code Playgroud)
同
PreparedStatement ps = session.prepare("INSERT INTO test.bounds (someid, someorder, words) VALUES (?, ?, ?)");
BoundStatement bs = ps.bind("id", "order", ImmutableSet.of(StringUtils.repeat('a', 66000)));
session.execute(bs);
Run Code Online (Sandbox Code Playgroud)
这将抛出预期的异常
Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: The sum of all clustering columns is too long (66024 > 65535)
Run Code Online (Sandbox Code Playgroud)
现在如果我改变表使用a List而不是aSet
CREATE TABLE test.bounds (
someid text,
someorder text,
words list<text>,
PRIMARY KEY (someid, someorder)
)
Run Code Online (Sandbox Code Playgroud)
并使用
BoundStatement bs = ps.bind("id", "order", ImmutableList.of(StringUtils.repeat('a', 66000)));
Run Code Online (Sandbox Code Playgroud)
我没有收到例外.但是,该文档指出,List值大小也限制为65535字节.文件是不正确还是我误解了?
我假设List值在底层存储中实现为简单列值,并且通过其时间戳维护订单.
| 归档时间: |
|
| 查看次数: |
383 次 |
| 最近记录: |