hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jean-Daniel Cryans" <jdcry...@apache.org>
Subject Re: How to add a column family from hirb?
Date Fri, 19 Sep 2008 14:07:19 GMT
Update : this issue is now https://issues.apache.org/jira/browse/HBASE-890

J-D

On Thu, Sep 18, 2008 at 12:13 PM, Dru Jensen <drujensen@gmail.com> wrote:

> What about adding another modifier?
>
> alter 'tablename', {operation => 'delete', name => 'old_column'}
>
> We could default the operation to 'modify' which is the current behavior.
>
> Also this will allow for multiple operations in one call:
>
> alter 'tablename', {operation => 'delete', name => 'old_column'},
> {operation => 'add', name => 'new_column'}
>
>
>
>
> On Sep 18, 2008, at 5:36 AM, Jean-Daniel Cryans wrote:
>
>  Dingding Ye,
>>
>> Definitely this is not optimal, but we accept all good patches ;)
>>
>> J-D
>>
>> On Thu, Sep 18, 2008 at 4:13 AM, Dingding Ye <yedingding@gmail.com>
>> wrote:
>>
>>  yes. we can do as following.
>>>
>>> admin.enableEnable(tablename);
>>> hcd = table.getTableDescriptor();
>>> admin.disableTable(tablename);
>>>
>>> But is this a good way to do that?
>>>
>>>
>>>
>>> On Thu, Sep 18, 2008 at 5:12 AM, stack <stack@duboce.net> wrote:
>>>
>>>> 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