我是Cassandra的新手。我尝试使用包含时间戳的longtype的复合键创建列族。这是代码:
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()));
答案 0 :(得分:0)
因为您插入了错误的日期。长度不合适。