Morad
Morad

Reputation: 774

Hbase: Store only column names with dummy values

I want to store a Set in an HBase row, the plan for now is to simply store the String as the column name and a dummy 0x01 value as the column value...

For example lets say I want to store users and a list of books they read, so I'd have the userId as the row key, and for every book that the user has read I'd store the book name as the column name and the string "1" as the value...

Is there a better way to design this?

Upvotes: 0

Views: 216

Answers (2)

Arnon Rotem-Gal-Oz
Arnon Rotem-Gal-Oz

Reputation: 25909

This is a reasonable approach as is, for example, serializing the list a single JSON column or having a row per book with the user as a prefix and the book as the second part of a composite key - The question is what do you want to do with it and what are your read/write patterns

Upvotes: 1

WestCoastProjects
WestCoastProjects

Reputation: 63032

Your approach is generally reasonable. You may also wish to look at Best way to store a set in hbase

Upvotes: 1

Related Questions