简体   繁体   中英

Hbase put multiple values in a single cell

In HBase, I would like to store more many record data into the cell value. For example, given the record: ParentId1, Child1Name,Child2Name,Child3Name I would like to store it as:

rowkey:ParentI1,cf-children:col-name:Child1Name,Chil2Name,Child3Name. So in the cell value I would like to add all the childrens name. Should I use a separator for storing these names or there is an API or best practices how to store them? Thank you.

You are trying to store one to many relation. And in that yours seem to be basic version. As here "many" are just strings. So, it is straight forward to store them with comma separated, and on the other side(while reading), you need to do the reverse. Extending this scenario to storing objects against string, approach would be different. Because the child(many) objects would also have identifiers themselves. So depending on your queries and retrieval logic, you can store entire jsonxml string of individual child as column qualifier value. You can look here for entity storage schema design

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM