假设数据集如下:
id age city phone
== === ==== =====
alfred 30 london 3281283
jeff 43 sydney 2342734
joe 29 tokyo 1283881
kelly 54 new york 2394929
molly 20 london 1823881
rob 39 sydney 4928381
要获取以下结果集..
id age phone
== === =====
alfred 30 3281283
joe 29 1283881
molly 20 1823881
。。使用SQL one会出现问题..
SELECT id, age, phone FROM dataset WHERE id IN ('alfred', 'joe', 'molly');
在一个命令中产生相同结果集的对应Cassandra API调用是什么?
发布于 2012-09-30 16:01:17
CQL (Cassandra的类似SQL的查询语言)现在支持:
SELECT ... WHERE keyalias IN ('key1', 'key2', 'key3', ...);
发布于 2010-03-15 15:02:53
您将使用alfred、joe和molly的密钥,以及id、column_names和multiget_slice的密钥执行一个SlicePredicate column_names
发布于 2010-03-15 15:23:52
Cassandra等价物可以建模,如下所述:
Users = { //this is a ColumnFamily
"alfred": { //this is the key to this Row inside the CF
"age":"30",
"city":"london",
"phone":"3281283"
}, // end row
// more rows...
}
其中"alfred“是您的(行)键,行有三列:年龄、城市和电话。(省略了三列的时间戳字段(为简单起见))
https://stackoverflow.com/questions/2445878
复制相似问题