说我有一列族
CREATE TABLE cnt_test (time_slot text , comp1 text, comp2 text, field1 counter, field2 counter, PRIMARY KEY(time_slot,comp1, comp2));
我现在想在它
UPDATE cnt_test SET field1=field1+1, field2=field2+2 WHERE time_slot='20130924' AND comp1='' AND comp2='ABC';
UPDATE cnt_test SET field1=field1+1, field2=field2+2 WHERE time_slot='20130924' AND comp1='' AND comp2='ABC';
UPDATE cnt_test SET field1=field1+1, field2=field2+2 WHERE time_slot='20130924' AND comp1='' AND comp2='ABC';
UPDATE cnt_test SET field1=field1+1, field2=field2+2 WHERE time_slot='20130924' AND comp1='' AND comp2='XYZ';
UPDATE cnt_test SET field1=field1+1, field2=field2+2 WHERE time_slot='20130924' AND comp1='PQR' AND comp2='';
插入一些数据,你可以在上面的陈述中看到我已经在复合关键部分中插入了一些空值,而不是null我将空白字符。
我甚至可以在同一
SELECT * FROM cnt_test WHERE time_slot='20130924' AND comp1='' AND comp2='ABC';
time_slot | comp1 | comp2 | field1 | field2
-----------+-------+-------+--------+--------
20130924 | | ABC | 4 | 8
(1 rows)
SELECT * FROM cnt_test WHERE time_slot='20130924' AND comp1='PQR' AND comp2='';
time_slot | comp1 | comp2 | field1 | field2
-----------+-------+-------+--------+--------
20130924 | PQR | | 1 | 2
(1 rows)
查询,以便总结每一件事情刚刚与空柱更换空列值即''
我们已经在做。基本上在节俭我们有像Decimal.Bytes组合列,那里我们可以有小数部分为空...想知道如何实现在CQL3 – Easility
我们在这里有同样的问题,我们如何移植到CQL3呢? –
我认为,**技术**它可能,但**语义** Datastax禁止为主键组件(这是有道理的)为空值。如果将component1,component2和component3作为组合,则为component2设置null将使您在字节数组中有一个“空洞”。对于分片查询和列排序,你可能会有奇怪的行为 – doanduyhai