Hi Jonathan, Strangely, using the Java client I have no other option than using string, and I end up with the same error:
Cassandra exception at put:InvalidRequestException(why:A long is exactly 8 bytes) with the following (scala) code, where "campaign.id" is a Long: client.insert("AdKit", "campaigns", new ColumnPath("Campaigns", null, (""+*campaign.id*).getBytes()), campaign.toJSON().getBytes("UTF-8"), System.currentTimeMillis(), ConsistencyLevel.ONE ) if I try to pass the long directly, here is what happens: [ERROR]example.scala:107: error: type mismatch; found : Long required: Array[Byte] new ColumnPath("Campaigns", null, campaign.id), The cassandra service Client.insert method has no override for lon values, which are only byte[] -- so I don't really know what to do. -- Sébastien 2010/1/21 Jonathan Ellis <jbel...@gmail.com> > cassandra-cli makes no attempt to deal with non-BytesType data types, > you will have to use a "real" thrift client. > > 2010/1/21 Sébastien Pierre <sebastien.pie...@gmail.com>: > > Hi ! > > So I moved forward using Cassandra for logging HTTP traffic, and I come > up > > with the following schema: > > > > <Keyspaces> > > <Keyspace Name="AdKit"> > > <ColumnFamily CompareWith="TimeUUIDType" Name="Logs"/> > > <ColumnFamily CompareWith="LongType" Name="Campaigns"/> > > </Keyspace> > > </Keyspaces> > > > > Next thing, I started cassandra-cli and wanted to populate the db with > some > > data: > > > > set AdKit.Campaigns['campaigns']['0'] = '{<JSON-encoded thing>}' > > > > however, I get the following error > > > > Exception null > > InvalidRequestException(why:A long is exactly 8 bytes) > > at > > > org.apache.cassandra.service.Cassandra$insert_result.read(Cassandra.java:7804) > > at > > > org.apache.cassandra.service.Cassandra$Client.recv_insert(Cassandra.java:391) > > at > > org.apache.cassandra.service.Cassandra$Client.insert(Cassandra.java:364) > > at org.apache.cassandra.cli.CliClient.executeSet(CliClient.java:205) > > at > org.apache.cassandra.cli.CliClient.executeCLIStmt(CliClient.java:60) > > at org.apache.cassandra.cli.CliMain.processCLIStmt(CliMain.java:103) > > at org.apache.cassandra.cli.CliMain.main(CliMain.java:143) > > > > but when I try this: > > > > set AdKit.Campaigns['campaigns'][0] = '{<JSON-encoded thing>}' > > > > I get another error > > > > line 1:33 mismatched input '0' expecting StringLiteral > > Exception null > > InvalidRequestException(why:column name must not be empty) > > at > > > org.apache.cassandra.service.Cassandra$insert_result.read(Cassandra.java:7804) > > at > > > org.apache.cassandra.service.Cassandra$Client.recv_insert(Cassandra.java:391) > > at > > org.apache.cassandra.service.Cassandra$Client.insert(Cassandra.java:364) > > at org.apache.cassandra.cli.CliClient.executeSet(CliClient.java:205) > > at > org.apache.cassandra.cli.CliClient.executeCLIStmt(CliClient.java:60) > > at org.apache.cassandra.cli.CliMain.processCLIStmt(CliMain.java:103) > > at org.apache.cassandra.cli.CliMain.main(CliMain.java:143) > > > > I wasn't able to find example with Long or Time keys... could somebody > > enlighten me ? > > > > -- Sébastien > > >