I have been trying to see if I can have nested columns in a cassandra column family either super or normal. I have look all over and have not fully seen what I am looking for.
I am wanting to do something like this.
`[{ firstname: "Me",
lastname: "Smith",
HomeAddress: { Street: "1234 Any Place Dr"
,State: "IL"
,zip: "62024"
}
}]`
From the following post Create a Cassandra schema for a super column with metadata
I found something similar but it is not working the way I wanted to.
create column family users
with comparator = UTF8Type
and compression_options = { sstable_compression:SnappyCompressor, chunk_length_kb:64}
and column_metadata = [
{ column_name: FirstName, validation_class : UTF8Type}
{ column_name: LastName, validation_class : UTF8Type},
{ column_name: FavStore, validation_class : IntegerType}
, { column_type: super, column_name: HomeAddress }
];
Here is my code that shows how I created my column family.
It creates it but then if I put the address in like the JSON example above it does not seem to work.
Here is my output when I do a list from the cli.
RowKey: 646f68616c6c
=> (column=FavStore, value=59580595188280, timestamp=1330696438)
=> (column=Favorites, value=HASH(0x3618bc0), timestamp=1330696438)
=> (column=FirstName, value=Me, timestamp=1330696438)
=> (column=HomeAddress, value=HASH(0x3618b30), timestamp=1330696438)
=> (column=LastName, value=Smith, timestamp=1330696438)
When I try and pull out the values from Home Address I get nothing. It appears that it is empty. I pulled it from some perl code and the Hash tells me that it is blank.
I am wondering if this is even possible and if it is not what is the best approach to add a sub column to a column family. Or am I just barking up the wrong tree.
Any info would be greatly appreciated.