hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stack <st...@duboce.net>
Subject Re: How to add a column family from hirb?
Date Wed, 17 Sep 2008 21:12:17 GMT
Pardon me if I do not have the full story, but can you not get the HTD and
save it aside in a variable?  Then disable the table, etc?
St.Ack

On Wed, Sep 17, 2008 at 11:41 AM, Dingding Ye <yedingding@gmail.com> wrote:

> I think a problem here is that
>
> We can't alter a enabled table, so we have to disable the table at
> first.  In the other side, we can't get the table descriptor if the
> table is disabled. Deadlock here.
>
> On Wed, Sep 17, 2008 at 12:28 AM, Dru Jensen <drujensen@gmail.com> wrote:
> > Maybe check to see if the column exists; If it does, modify otherwise
> add?
> >
> >    def alter(tableName, args)
> >      now = Time.now
> >      raise TypeError.new("Table name must be of type String") \
> >        unless tableName.instance_of? String
> >      descriptor = hcd(args)
> >      table = HTable.new(tableName)
> >      if (table.getTableDescriptor().hasFamily(descriptor.name))
> >        @admin.modifyColumn(tableName, descriptor.getNameAsString(),
> > descriptor);
> >      else
> >        @admin.addColumn(tableName, descriptor);
> >      end
> >      @formatter.header()
> >      @formatter.footer(now)
> >    end
> >
> > Although this doesn't allow you to delete a column.
> >
> > On Sep 16, 2008, at 6:05 AM, Cosmin Lehene wrote:
> >
> >> Thanks,
> >>
> >> Here's the alter implementation:
> >>
> >>   def alter(tableName, args)
> >>     now = Time.now
> >>     raise TypeError.new("Table name must be of type String") \
> >>       unless tableName.instance_of? String
> >>     descriptor = hcd(args)
> >>     @admin.modifyColumn(tableName, descriptor.getNameAsString(),
> >> descriptor);
> >>     @formatter.header()
> >>     @formatter.footer(now)
> >>   end
> >>
> >> It looks like it needs some logic to add a new column family
> >> @admin.addColumn
> >> I could implement it, however if I were to send a patch I'd need to know
> >> the syntax philosophy. Currently there's only one verb per command and
> for
> >> alter... Add column we would have two verbs: alter and add. Should this
> be
> >> something like alter 'table', {COLUMN => 'new_family_name'} or
> >> {NEW_COLUMN => ..} etc, or should we pass the add verb somehow as an
> >> argument?
> >>
> >> Cosmin
> >>
> >>
> >>
> >> On 9/16/08 3:35 PM, "Samuel Guo" <guosijie@gmail.com> wrote:
> >>
> >> "alter" just do the *modification* operation.
> >>
> >> I think that you can write some functions in *HBase.rb* to implements
> "add
> >> families" operations:)
> >>
> >> On Tue, Sep 16, 2008 at 7:51 PM, Cosmin Lehene <clehene@adobe.com>
> wrote:
> >>
> >>> Hi,
> >>>
> >>> I've been trying to add a column family from the new shell. The
> >>> documentation doesn't really expose this. Is it still possible to do
> >>> this?
> >>> It appears alter only deals with existing column families, not tables.
> >>>
> >>> Any hints?
> >>>
> >>> Thanks,
> >>> Cosmin
> >>>
> >>>
> >>
> >
> >
>

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