2
我是Cassandra的新手。我正在嘗試創建一個包含時間戳longtype的組合鍵的列族。下面是代碼:InvalidRequestException(爲什麼:日期期望爲8或0字節)cassandra
Composite cs = new Composite();
cs.addComponent(id, StringSerializer.get());
cs.addComponent(tstamp, DateSerializer.get());
Mutator mutator = HFactory.createMutator(keyspace, stringSerializer);
mutator.insert(id, cf.getName(), HFactory.createColumn(cs, id, CompositeSerializer.get(), StringSerializer.get()));
mutator.insert(id, cf.getName(), HFactory.createColumn("ipaddress", usrlog.getIpaddress()));
mutator.insert(id, cf.getName(), HFactory.createColumn("timestamp", tstamp.getTime(), StringSerializer.get(), LongSerializer.get()));
mutator.insert(id, cf.getName(), HFactory.createColumn("search_term", usrlog.getSearchterm()));
mutator.insert(id, cf.getName(), HFactory.createColumn("user_agent", usrlog.getUseragent()));