The timestamp as column family qualifier on sub_comments seems redundant since HBase sorts already in reverse timestamp order. Why not instead name your column as sub_comment:data_comment_id and then just do a Get w/ maximum versions set to the number of returns you want (You can even supply a TimeRange to Get and it should do the right thing).
St.Ack On Mon, Feb 7, 2011 at 3:25 AM, Bui Ngoc Son <[email protected]> wrote: > Hi everyone, > > I am going to implement a facebook-like comments system (with main comments > and their sub-comments), using HBase 0.90. I designed the storage of > comments as follow: > > - Row key is composite row key. Each row key is a composition of user id and > timestamp (in reverse order). With this row key, i can easily get top n > newest main comments of a specific user. > > - Each row has two column family: "data" and "sub_comment" > + The "data" family stores information of main comment, such as comment > content, user id of poster, time of post... > + The "sub_comment" family, as its name, store all the sub comments. The > number of columns in this family equal the number of sub-comments, and > column names follow this format: "sub-comment:timestamp" (timestamp in > reverse order), and its value is the content of sub-comment. > > So, my question is, is there any way to get the first n columns (ordered by > timestamp) of the "sub_comment" family? I searched arround google and this > mailing list, but cannot find this information. > I know that i can use different versions of a column to solve this problem, > but for some reasons, i do not want to use multiple versions of a column. > > Thanks in advance > > Eddie Bui, >
