You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "stack (Commented) (JIRA)" <ji...@apache.org> on 2012/04/03 07:38:36 UTC

[jira] [Commented] (HBASE-5548) Add ability to get a table in the shell

    [ https://issues.apache.org/jira/browse/HBASE-5548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13244993#comment-13244993 ] 

stack commented on HBASE-5548:
------------------------------

Patch looks fine.  Needs --no-prefix so I can pass it via hadoopqa.  Needs a fat release note too.  Patch applied for me.  I was able to do basic new functionality operations.  I'd say its good to go.

I installed the patch, when I do general 'help', I see nothing on this new facility.  I probably should?

When I create a table, the output is kinda ugly?  I suppose no way around it.... its not end of world.  Then when I do t.help it dumps out the help unformatted as in:

{code}
hbase(main):003:0* t = create 't', 'f'
0 row(s) in 0.2220 seconds

=> #<Hbase::Table:0x3067e236 @table=#<Java::OrgApacheHadoopHbaseClient::HTable:0x6d386751>, @name="t", @shell=#<Shell::Shell:0x159576c3 @formatter=#<Shell::Formatter::Console:0x7a80747 @out=Kernel, @row_count=0, @max_width=364>, @hbase_admin=#<Hbase::Admin:0x2875ca3e @zk_wrapper=#<#<Class:0x4d30c132>:0x300b6421>, @zk_main=#<Java::OrgApacheZookeeper::ZooKeeperMain:0x609e7d46>, @formatter=#<Shell::Formatter::Console:0x7a80747 @out=Kernel, @row_count=0, @max_width=364>, @conf=#<Java::OrgApacheHadoopConf::Configuration:0x14235085>, @admin=#<Java::OrgApacheHadoopHbaseClient::HBaseAdmin:0x788ebb5a>>, @hbase=#<Hbase::Hbase:0x21e8614a @configuration=#<Java::OrgApacheHadoopConf::Configuration:0x14235085>>>>
hbase(main):004:0> t.help
=> "       Access an HTable. The table is accessed based on the name of the table\n       and the current default configuration (hbase-site.xml and hbase-default.xml).\n\n       There are a variety of things you can do with a table. For instance, say\n       you have a table 't':\n\n         hbase> t.scan\n\n       Will get you all the rows in t.\n\n       Similarly, to put a row into table t, assuming it was created with\n       the column family 'fam':\n\n         hbase> t.put 'row', 'fam', 'value'\n\n       Other commands include things like: get, delete, deleteall,\n         get_all_columns, get_counter, count, incr. These functions, along with\n         the standard JRuby object methods are also available via tab completion.\n\n       For more information on how to use each of these commands, you can also just\n       type:\n\n         hbase> t.help 'scan'\n\n       which will output more information on how to use that command.\n\n       You can also do general admin actions directly on a table; things like enable, disable,\n       flush and drop just by typing:\n\n         hbase> t.enable\n         hbase> t.flush\n         hbase> t.disable\n         hbase> t.drop\n\n      Note that after dropping a table, your reference to it becomes useless and further usage\n      is undefined (and not recommended).\n\n      General help on this commands can also be obtained similarly to other table-centric commands.\n"
{code}

Does that happen for you?

If I do t.put, w/ wrong args it gives me the help but its general help rather than help for my table context:

{code}
hbase(main):006:0> t.put 'x', 'x:x', 'x'

ERROR: org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException: Failed 1 action: DoNotRetryIOException: 1 time, servers with issues: pynchon:57156, 

Here is some help for this command:
Put a cell 'value' at specified table/row/column and optionally
timestamp coordinates.  To put a cell value into table 't1' at
row 'r1' under column 'c1' marked with the time 'ts1', do:

  hbase> put 't1', 'r1', 'c1', 'value', ts1
{code}

This stuff works though:

{code}
hbase(main):019:0> put 't', 'x', 'f:x', 'x'
0 row(s) in 0.0330 seconds

hbase(main):020:0> t.put 'y', 'f:x', 'x'
0 row(s) in 0.0450 seconds
hbase(main):021:0> t.scan
ROW                                                                                          COLUMN+CELL                                                                                                                                                                                                                                                                    
 x                                                                                           column=f:x, timestamp=1333431415571, value=x                                                                                                                                                                                                                                   
 y                                                                                           column=f:x, timestamp=1333431427136, value=x   
{code}
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0, 0.94.1
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, ruby_HBASE-5548-v2.patch, ruby_HBASE-5548-v3.patch
>
>
> Currently, all the commands that operate on a table in the shell first have to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira