简体   繁体   中英

HBase one-to-many relationship with multiple columns

I have been trying to use HBase one-to-many relationship storage. Consider, I have Person table to maintain his/her loans. A person can have multiple loans and I need to store the loan and it's type.

I have gone through the example given here and here , based on that I have kept loan as column family, loans(has unique id) as columns and its type as value. Below is my structure of my Person table

ROW     COLUMN+CELL
dinesh  column=loan:DFGHBCN, timestamp=1563443783271, value=home
dinesh  column=loan:FBCPOIBAMN,timestamp=1563443796628, value=personal
dinesh  column=loan:XPABSTWLMN,timestamp=1563443815217,value=personal

I want to get the person who has a particular loan from this table. I wasn't able to do it . So I changed the structure like below-

ROW     COLUMN+CELL
dinesh  column=loan:loan_1, timestamp=1563443783271, value=DFGHBCN
dinesh  column=loan:type_1, timestamp=1563443783271, value=home
dinesh  column=loan:loan_2,timestamp=1563443796628, value=FBCPOIBAMN
dinesh  column=loan:type_2,timestamp=1563443796628, value=personal
dinesh  column=loan:loan_3,timestamp=1563443815217,value=XPABSTWLMN
dinesh  column=loan:type_3,timestamp=1563443815217,value=personal

I can able to fetch the person name using ColumnPrefixFilter. I need help on the following

  1. How can I achieve one-to-many relationship with multiple columns in HBase and how can I store them?
  2. Is there any query to fetch row key by matching the column name? if I am able to achieve can this can I fix the first structure for one-to-many relationship?

I am proceeding with first structure as I am able to get the row key by matching the column name(loan id) with the help of ColumnPrefixFilter. Any suggestions/alterations on this please let me know.

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