Hi Rams, Even if a customer can have multiple addresses, you can still simply put them all on the same field...
A ArrayList of address, converted in a JSon sting, in a single HBase cell will still do it. You can have them on separated cells if you think you will access them separatly. You can also have different columns identifiers for each type of address you can have. Like you have CF1 for all you fields, C=Infos for the customer info, C=PHY for Physical address, C=HOM for home address, C=OFF for office address, and so on? The idea is to reduce the CFs if not required, and really think about the way you access your data. If you access all the address at the same time, then simply put all of them on the same cell, on a Array of Address converted in String with JSon. So simple ;) JM 2012/12/24, Ramasubramanian <[email protected]>: > Hi, > > Let me explain the scenario. > > For address of the customer we have designed 3 tables (in relational way) > > 1. Address link table > Will have key columns like > Address type - physical or email /fax/phone/URL/ etc., > Address category- (home/work) > Primary address indicator > Bad address indicator > Etc., > 2. Physical address > This will contain the actual physical address. A customer can have n > Number of addresses. > Fields : > - address type (physical) > - address category (home/work/etc.,) > - address1 > - address 2 > ......... > 3. Electronic address > It will contain email/fax/phone/URL etc, and it's value > Fields : > - address type (email /fax/phone/URL/ etc.,) > - address category (home/work/etc.,) > - value ( actual value based on address type. Like actual phone > number) > > > Now in the above scenario, while designing in hbase, I am going to eliminate > link table and have those fields in both physical and electronic address. > > So both the tables has common fields like address type and address category. > Hence thought of having these two fields common for both the set of fields. > (In a single table) > > Regards, > Rams > > On 24-Dec-2012, at 6:45 PM, Mohammad Tariq <[email protected]> wrote: > >> it is. but why do you want to do that? you will run into issues once >> your >> data starts growing. each cell, along with the actual value stores few >> additional things, *row, column *and the *version. *as a result you will >> loose space if you do that. >> >> Best Regards, >> Tariq >> +91-9741563634 >> https://mtariq.jux.com/ >> >> >> On Mon, Dec 24, 2012 at 5:00 PM, Ramasubramanian Narayanan < >> [email protected]> wrote: >> >>> Hi, >>> >>> Is it ok to have same column into different column familes? >>> >>> regards, >>> Rams >>> >>> On Mon, Dec 24, 2012 at 4:06 PM, Mohammad Tariq <[email protected]> >>> wrote: >>> >>>> you are creating 2 different rows here. cf means how column are clubbed >>>> together as a single entity which is represented by that cf. but here >>>> you >>>> are creating 2 different rows having one cf each, CF1 and CF2 >>> respectively. >>>> if you want to have 1 row with 2 cf, you have to do use same rowkey for >>>> both the cf. >>>> >>>> >>>> >>>> Best Regards, >>>> Tariq >>>> +91-9741563634 >>>> https://mtariq.jux.com/ >>>> >>>> >>>> On Mon, Dec 24, 2012 at 3:41 PM, Ramasubramanian Narayanan < >>>> [email protected]> wrote: >>>> >>>>> Hi, >>>>> >>>>> *Table Name : Customer* >>>>> * >>>>> * >>>>> *Field Name Column Family* >>>>> Customer Number CF1 >>>>> DOB CF1 >>>>> FName CF1 >>>>> MName CF1 >>>>> LName CF1 >>>>> Address Type CF2 >>>>> Address Line1 CF2 >>>>> Address Line2 CF2 >>>>> Address Line3 CF2 >>>>> Address Line4 CF2 >>>>> State CF2 >>>>> City CF2 >>>>> Country CF2 >>>>> >>>>> Is it good to have rowkey as follows for the same table? >>>>> >>>>> Rowkey Design: >>>>> -------------- >>>>> For CF1 : Customer Number + YYYYMMD (business date) >>>>> For CF2 : Customer Number + Address Type >>>>> >>>>> Note : >>>>> Address Type can be any of HOME/OFFICE/OTHERS >>>>> >>>>> regards, >>>>> Rams >>> >
