Cassandra 集合类型中的大值

Big values in Cassandra collections types

是否可以将大值(超过 65535 字节)放入 Cassandra 集合类型中?

datastax 文档说明了如何使用集合 (http://www.datastax.com/documentation/cql/3.1/cql/cql_using/use_collections_c.html) "The maximum size of an item in a collection is 64K"

另一边的 CQL 限制 (http://www.datastax.com/documentation/cql/3.1/cql/cql_reference/refLimits.html) "Collection item, value of: 2GB (Cassandra 2.1 v3 protocol), 64K (Cassandra 2.0.x and earlier)"

所以,有了 Cassandra 集群版本 2.1,所以我期待它可以增加很大的价值,但我得到了错误:

<stdin>:12:code=2200 [Invalid query] message="Map value is too long. Map values are limited to 65535 bytes but 100000 bytes value provided"

我的 CQL shell 版本是:

[cqlsh 5.0.1 | Cassandra 2.1.2 | CQL spec 3.2.0 | Native protocol v3]

导致上述错误的脚本示例:

DROP KEYSPACE example;
CREATE KEYSPACE example WITH replication = {'class':'SimpleStrategy', 'replication_factor':1};
USE example;

CREATE TABLE IF NOT EXISTS big_map_values (
    person_id  int,
    images map<text, blob>,  -- map: md5(url) -> image
    PRIMARY KEY(person_id)
);

INSERT INTO big_map_values (person_id, images) 
VALUES(17, {'6fa9093ec07a71f859cae269feee18ec' : textAsBlob('in real sample code I have 10000 a characters here')});

在我看来,他们的文档中存在问题。

这里是Cassandra的源码,可以清楚的看到map有64K的限制。 https://github.com/apache/cassandra/blob/cassandra-2.1.3/src/java/org/apache/cassandra/cql3/Maps.java

自 2013 年 3 月 21 日以来未修改引发错误的特定行