我可以在cassandra中创建一个动态且可以查询的列,
例如,
客户可以拥有1到n个地址,
每个地址可以被称为ADDRESS1(某个地址),ADDRES2(某个地址),ADDRESS3(某个地址)...... ADDRESSN
我如何在cassandra中表示这一点,我应该能够在特定地址查询客户或地址。
请指教。
答案 0 :(得分:0)
首先使用比较器类型UTF8Type
创建列族create column family customerAddress
with column_type = 'Standard'
and comparator = 'UTF8Type'
and default_validation_class = 'UTF8Type'
and key_validation_class = 'UTF8Type';
,你的代表就像这样
customerAddress
RowKey: customerId
=> (name=ADDRESS1, value=(some address) , timestamp=1396344612290000)
=> (name=ADDRESS2, value=(some address) , timestamp=1396344612290000)
=> (name=ADDRESS3, value=(some address) , timestamp=1396344612290000)
=> (name=ADDRESS4, value=(some address) , timestamp=1396344612290000)
......
......
=> (name=ADDRESSN, value=(some address) , timestamp=1396344612290000)