Reputation: 639
If I create a table like this in Cassandra
CREATE TABLE example (
key1 text PRIMARY KEY,
map1 map<text,text>,
list1 list<text>,
set1 set<text>
);
and insert some data like this
INSERT INTO example (
key1,
map1,
list1,
set1
) VALUES (
'john',
{'patricia':'555-4326','doug':'555-1579'},
['doug','scott'],
{'patricia','scott'}
);
and look at the storage using CLI, I will see this
RowKey: john
=> (column=, value=, timestamp=1374683971220000)
=> (column=map1:doug, value='555-1579', timestamp=1374683971220000)
=> (column=map1:patricia, value='555-4326', timestamp=1374683971220000)
=> (column=list1:26017c10f48711e2801fdf9895e5d0f8, value='doug', timestamp=1374683971220000)
=> (column=list1:26017c12f48711e2801fdf9895e5d0f8, value='scott', timestamp=1374683971220000)
=> (column=set1:'patricia', value=, timestamp=1374683971220000)
=> (column=set1:'scott', value=, timestamp=1374683971220000)
Now my question is this: what is the first row in CLI output? what does it mean? why it does not have any Column nor Value but has a timestamp?
Upvotes: 1
Views: 86
Reputation: 20946
The "row marker" was introduced [1] so the row doesn't disappear when you remove (set a column to null) the last column. Aligned with how traditional SQL implementations behaves)
You have also found out how cassandra represents collections under the hood. Remember that
[1] https://issues.apache.org/jira/browse/CASSANDRA-4361
Upvotes: 1
Reputation: 313
This because while using cassandra-cli, you get a thrift representation of the rows. First information are for primary key, as your is just a partition key, it's the same as the row key. So you have your value : as rowKey (John in your example) then the timestamp
You will have more readable result set if you usin cqlsh instead. you can find more detail here : https://thelastpickle.com/blog/2013/01/11/primary-keys-in-cql.html
I hope this helps
Upvotes: 0