hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matteo Bertozzi <theo.berto...@gmail.com>
Subject Re: How to Create a Column in Hbase using Hbase Client API
Date Tue, 29 Apr 2014 19:14:12 GMT
HBase does not have the concept of "static" columns.
You just have "groups" the column families
and then each row has a set of qualifiers.

so, you don't need to specify the set of columns (qualifiers) on
"initialization"
you just add/update rows with the specified column

so you end up doing something like this pseudo code

createTable(tableName, group1, group2);
table.put(row0, column0, value)
table.put(row1, column0, value)


Matteo



On Tue, Apr 29, 2014 at 12:09 PM, Chamika Kasun <kasun.chamika@gmail.com>wrote:

> Yes this code is correct. Here what the code does is only create a column
> family. What i want to do is inside the column family i want to create
> several columns. In this documentation
> <
> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/HTableDescriptor.html
> >for
> the "Class HTableDescripter" it says that addFamily(hcd); creates a column
> family NOT A Column.
>
> *addFamily
> <
> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/HTableDescriptor.html#addFamily(org.apache.hadoop.hbase.HColumnDescriptor)
> >*
> (HColumnDescriptor<
> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/HColumnDescriptor.html
> >
>  family)
> Adds a column family.
>
> In my project what i want to do is create several columns inside that
> column family. In Hbase Documentation it termed as "qualifier". That is i
> want to create several qualifiers inside a column family which can be
> created from the above code snippet.
>
>
> On Tue, Apr 29, 2014 at 11:49 PM, Ted Yu <yuzhihong@gmail.com> wrote:
>
> > When create your table, you specify the column families in the table
> (code
> > snippet from TestFromClientSide3.java):
> >
> >     HTableDescriptor htd =
> > newHTableDescriptor(hTable.getTableDescriptor());
> >
> >     HColumnDescriptor hcd = new HColumnDescriptor(htd.getFamily(FAMILY));
> >
> >     htd.addFamily(hcd);
> >
> >     admin.createTable(htd);
> >
> > When you insert data, you specify column along with data value.
> >
> >
> > Cheers
> >
> >
> > On Tue, Apr 29, 2014 at 11:08 AM, Chamika Kasun <kasun.chamika@gmail.com
> > >wrote:
> >
> > > Hi all,
> > >
> > > Here what i want to do is i want to firstly need to create and a column
> > > family and then need to create a column for data to be added later.
> Here
> > i
> > > can not use PUT command as it requires a value parameter(because idea
> of
> > > that application is first initiate the table and data will be added
> > later).
> > > Please help me out. I'm really new to hbase
> > >
> >
>
>
>
> --
> Chamika Kasun.
> Undergraduate.
> Computer Science & Engineering
> University of Moratuwa.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message