I'm very new to Cassandra and trying out Astyanax/CQL3 for some simple use cases. I am attempting to retrieve data from a simple table using Astyanax and CQL3 on Cassandra version 1.2 from a Groovy application.
I have the following column family (table):
CREATE TABLE t_index_credential (
id varchar,
versions map<timestamp,varchar>,
PRIMARY KEY (id)
);
The following rows exist in the table:
id | versions
-----+---------------------------------
xyz | {2001-01-01 00:00:00-0500: 1.0}
This is how I'm querying the data:
def id = "xyz"
def cfName = "t_index_credential"
def mapSerializer = new MapSerializer<Date,String>(DateType.instance, UTF8Type.instance)
def strSerializer = StringSerializer.get()
def cf = ColumnFamily.newColumnFamily(cfName, strSerializer, mapSerializer)
def cql = "SELECT * FROM ${cfName} WHERE id = '${id}';"
def query = keyspace.prepareQuery(cf).withCql(cql)
def result = query.execute().getResult()
result.getRows().each { row ->
println "rowKey: " + row.getKey()
}
The output of this is:
rowKey: null
Attempting to access any of the columns in the row results in the following:
result.getRows().each { row ->
row.getColumns().each { col ->
println col.dump()
}
}
org.apache.cassandra.db.marshal.MarshalException: Not enough bytes to read a map
It feels as if I'm missing something very simple. Am I doing anything right?