InvalidRequestException(为什么:日期预期为8或0字节)cassandra

时间:2014-07-08 12:33:45

标签: java cassandra hector

我是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()));

1 个答案:

答案 0 :(得分:0)

因为您插入了错误的日期。长度不合适。