HBase
  1. HBase
  2. HBASE-5548

Add ability to get a table in the shell

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.95.0
    • Component/s: shell
    • Labels:
      None
    • Hadoop Flags:
      Reviewed
    • Release Note:
      Hide
      Adding the ability to get a reference to a table in the shell.

      Previously, all commands that acted on a table would need to take the name of the table as a string, which is annoying in an OO REPL. This patch introduces the ability to get and hold a reference to a table both on creation (via create(...)) and at will (via get_table(...)).

      Further, to actually make the table useful, modifications to table specific class were made so you can have a reference and just do things like put, scan, get, etc. on that table reference. To accommodate new table functionality, table specific methods are easily added (one line) in a dynamic fashion via class methods in the Table. See examples in get, put, scan, etc..

      There is also a lot of admin functionality tied to a table - things like disabling, dropping, describing, etc - that were added to the table class. Now you can do things like 'table.disable' and 'table.describe'. Again these were dynamically added, so new admin functionality for a table is as simple as adding the method name to one line in the Table class.
      Show
      Adding the ability to get a reference to a table in the shell. Previously, all commands that acted on a table would need to take the name of the table as a string, which is annoying in an OO REPL. This patch introduces the ability to get and hold a reference to a table both on creation (via create(...)) and at will (via get_table(...)). Further, to actually make the table useful, modifications to table specific class were made so you can have a reference and just do things like put, scan, get, etc. on that table reference. To accommodate new table functionality, table specific methods are easily added (one line) in a dynamic fashion via class methods in the Table. See examples in get, put, scan, etc.. There is also a lot of admin functionality tied to a table - things like disabling, dropping, describing, etc - that were added to the table class. Now you can do things like 'table.disable' and 'table.describe'. Again these were dynamically added, so new admin functionality for a table is as simple as adding the method name to one line in the Table class.

      Description

      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.

      1. ruby_HBASE-5548-addendum.patch
        14 kB
        Jesse Yates
      2. ruby_HBASE-5548-v5.patch
        28 kB
        Jesse Yates
      3. ruby_HBASE-5548-v3.patch
        22 kB
        Jesse Yates
      4. ruby_HBASE-5548-v2.patch
        9 kB
        Jesse Yates
      5. ruby_HBASE-5548-v1.patch
        9 kB
        Jesse Yates
      6. ruby_HBASE-5528-v0.patch
        4 kB
        Jesse Yates

        Issue Links

          Activity

          Hide
          stack added a comment -

          Marking closed.

          Show
          stack added a comment - Marking closed.
          Hide
          Hudson added a comment -

          SUCCESS: Integrated in HBase-TRUNK-on-Hadoop-2.0.0 #719 (See https://builds.apache.org/job/HBase-TRUNK-on-Hadoop-2.0.0/719/)
          HBASE-9449 document how to use shell enhancements from HBASE-5548 (jmhsieh: rev 1521288)

          • /hbase/trunk/src/main/docbkx/shell.xml
          Show
          Hudson added a comment - SUCCESS: Integrated in HBase-TRUNK-on-Hadoop-2.0.0 #719 (See https://builds.apache.org/job/HBase-TRUNK-on-Hadoop-2.0.0/719/ ) HBASE-9449 document how to use shell enhancements from HBASE-5548 (jmhsieh: rev 1521288) /hbase/trunk/src/main/docbkx/shell.xml
          Hide
          Hudson added a comment -

          SUCCESS: Integrated in HBase-TRUNK #4482 (See https://builds.apache.org/job/HBase-TRUNK/4482/)
          HBASE-9449 document how to use shell enhancements from HBASE-5548 (jmhsieh: rev 1521288)

          • /hbase/trunk/src/main/docbkx/shell.xml
          Show
          Hudson added a comment - SUCCESS: Integrated in HBase-TRUNK #4482 (See https://builds.apache.org/job/HBase-TRUNK/4482/ ) HBASE-9449 document how to use shell enhancements from HBASE-5548 (jmhsieh: rev 1521288) /hbase/trunk/src/main/docbkx/shell.xml
          Hide
          Hudson added a comment -

          SUCCESS: Integrated in hbase-0.96-hadoop2 #14 (See https://builds.apache.org/job/hbase-0.96-hadoop2/14/)
          HBASE-9449 document how to use shell enhancements from HBASE-5548 (jmhsieh: rev 1521287)

          • /hbase/branches/0.96/src/main/docbkx/shell.xml
          Show
          Hudson added a comment - SUCCESS: Integrated in hbase-0.96-hadoop2 #14 (See https://builds.apache.org/job/hbase-0.96-hadoop2/14/ ) HBASE-9449 document how to use shell enhancements from HBASE-5548 (jmhsieh: rev 1521287) /hbase/branches/0.96/src/main/docbkx/shell.xml
          Hide
          Hudson added a comment -

          FAILURE: Integrated in hbase-0.96 #26 (See https://builds.apache.org/job/hbase-0.96/26/)
          HBASE-9449 document how to use shell enhancements from HBASE-5548 (jmhsieh: rev 1521287)

          • /hbase/branches/0.96/src/main/docbkx/shell.xml
          Show
          Hudson added a comment - FAILURE: Integrated in hbase-0.96 #26 (See https://builds.apache.org/job/hbase-0.96/26/ ) HBASE-9449 document how to use shell enhancements from HBASE-5548 (jmhsieh: rev 1521287) /hbase/branches/0.96/src/main/docbkx/shell.xml
          Hide
          stack added a comment -

          I committed this a while back.

          Show
          stack added a comment - I committed this a while back.
          Hide
          Jesse Yates added a comment -

          do we want to close this ticket now?

          Show
          Jesse Yates added a comment - do we want to close this ticket now?
          Hide
          Hudson added a comment -

          Integrated in HBase-TRUNK-security #190 (See https://builds.apache.org/job/HBase-TRUNK-security/190/)
          HBASE-5548 Add ability to get a table in the shell; BACKING OUT MISTAKEN CO-COMMIT OF HBASE-5840 (Revision 1333123)

          Result = SUCCESS
          stack :
          Files :

          • /hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
          • /hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
          Show
          Hudson added a comment - Integrated in HBase-TRUNK-security #190 (See https://builds.apache.org/job/HBase-TRUNK-security/190/ ) HBASE-5548 Add ability to get a table in the shell; BACKING OUT MISTAKEN CO-COMMIT OF HBASE-5840 (Revision 1333123) Result = SUCCESS stack : Files : /hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java /hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
          Hide
          Hudson added a comment -

          Integrated in HBase-TRUNK #2837 (See https://builds.apache.org/job/HBase-TRUNK/2837/)
          HBASE-5548 Add ability to get a table in the shell; BACKING OUT MISTAKEN CO-COMMIT OF HBASE-5840 (Revision 1333123)

          Result = SUCCESS
          stack :
          Files :

          • /hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
          • /hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
          Show
          Hudson added a comment - Integrated in HBase-TRUNK #2837 (See https://builds.apache.org/job/HBase-TRUNK/2837/ ) HBASE-5548 Add ability to get a table in the shell; BACKING OUT MISTAKEN CO-COMMIT OF HBASE-5840 (Revision 1333123) Result = SUCCESS stack : Files : /hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java /hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
          Hide
          stack added a comment -

          Backed out the miscommit of hbase-5840 that went in with this. Sorry for the mess. Thanks Ram for fingering it.

          Show
          stack added a comment - Backed out the miscommit of hbase-5840 that went in with this. Sorry for the mess. Thanks Ram for fingering it.
          Hide
          stack added a comment -

          Ok. Over in hbase-5840 I say I'm going to leave it in but instead I'm going to back it out so its easier on the fellows who are trying to follow behind us trying to make sense of our actions.

          Show
          stack added a comment - Ok. Over in hbase-5840 I say I'm going to leave it in but instead I'm going to back it out so its easier on the fellows who are trying to follow behind us trying to make sense of our actions.
          Hide
          stack added a comment -

          Hmm... did I? It doesn't list the files above. Let me check.

          Show
          stack added a comment - Hmm... did I? It doesn't list the files above. Let me check.
          Hide
          ramkrishna.s.vasudevan added a comment -

          @Stack
          I think you committed HBASE-5840 also along with this!!!

          Show
          ramkrishna.s.vasudevan added a comment - @Stack I think you committed HBASE-5840 also along with this!!!
          Hide
          Hudson added a comment -

          Integrated in HBase-TRUNK-security #189 (See https://builds.apache.org/job/HBase-TRUNK-security/189/)
          HBASE-5548 Add ability to get a table in the shell; ADDENDUM (Revision 1332766)

          Result = SUCCESS
          stack :
          Files :

          • /hbase/trunk/src/main/ruby/hbase/table.rb
          • /hbase/trunk/src/main/ruby/shell/commands/count.rb
          • /hbase/trunk/src/main/ruby/shell/commands/deleteall.rb
          • /hbase/trunk/src/main/ruby/shell/commands/get_counter.rb
          • /hbase/trunk/src/test/ruby/hbase/admin_test.rb
          • /hbase/trunk/src/test/ruby/hbase/table_test.rb
          • /hbase/trunk/src/test/ruby/shell/commands_test.rb
          • /hbase/trunk/src/test/ruby/test_helper.rb
          Show
          Hudson added a comment - Integrated in HBase-TRUNK-security #189 (See https://builds.apache.org/job/HBase-TRUNK-security/189/ ) HBASE-5548 Add ability to get a table in the shell; ADDENDUM (Revision 1332766) Result = SUCCESS stack : Files : /hbase/trunk/src/main/ruby/hbase/table.rb /hbase/trunk/src/main/ruby/shell/commands/count.rb /hbase/trunk/src/main/ruby/shell/commands/deleteall.rb /hbase/trunk/src/main/ruby/shell/commands/get_counter.rb /hbase/trunk/src/test/ruby/hbase/admin_test.rb /hbase/trunk/src/test/ruby/hbase/table_test.rb /hbase/trunk/src/test/ruby/shell/commands_test.rb /hbase/trunk/src/test/ruby/test_helper.rb
          Hide
          Hudson added a comment -

          Integrated in HBase-TRUNK #2832 (See https://builds.apache.org/job/HBase-TRUNK/2832/)
          HBASE-5548 Add ability to get a table in the shell; ADDENDUM (Revision 1332766)

          Result = FAILURE
          stack :
          Files :

          • /hbase/trunk/src/main/ruby/hbase/table.rb
          • /hbase/trunk/src/main/ruby/shell/commands/count.rb
          • /hbase/trunk/src/main/ruby/shell/commands/deleteall.rb
          • /hbase/trunk/src/main/ruby/shell/commands/get_counter.rb
          • /hbase/trunk/src/test/ruby/hbase/admin_test.rb
          • /hbase/trunk/src/test/ruby/hbase/table_test.rb
          • /hbase/trunk/src/test/ruby/shell/commands_test.rb
          • /hbase/trunk/src/test/ruby/test_helper.rb
          Show
          Hudson added a comment - Integrated in HBase-TRUNK #2832 (See https://builds.apache.org/job/HBase-TRUNK/2832/ ) HBASE-5548 Add ability to get a table in the shell; ADDENDUM (Revision 1332766) Result = FAILURE stack : Files : /hbase/trunk/src/main/ruby/hbase/table.rb /hbase/trunk/src/main/ruby/shell/commands/count.rb /hbase/trunk/src/main/ruby/shell/commands/deleteall.rb /hbase/trunk/src/main/ruby/shell/commands/get_counter.rb /hbase/trunk/src/test/ruby/hbase/admin_test.rb /hbase/trunk/src/test/ruby/hbase/table_test.rb /hbase/trunk/src/test/ruby/shell/commands_test.rb /hbase/trunk/src/test/ruby/test_helper.rb
          Hide
          stack added a comment -

          Committed addendum. Thanks for following up Ted (and you Jesse)

          Show
          stack added a comment - Committed addendum. Thanks for following up Ted (and you Jesse)
          Hide
          Jesse Yates added a comment -

          thanks stack!

          Show
          Jesse Yates added a comment - thanks stack!
          Hide
          Hadoop QA added a comment -

          -1 overall. Here are the results of testing the latest attachment
          http://issues.apache.org/jira/secure/attachment/12525162/ruby_HBASE-5548-addendum.patch
          against trunk revision .

          +1 @author. The patch does not contain any @author tags.

          +1 tests included. The patch appears to include 12 new or modified tests.

          +1 hadoop23. The patch compiles against the hadoop 0.23.x profile.

          +1 javadoc. The javadoc tool did not generate any warning messages.

          +1 javac. The applied patch does not increase the total number of javac compiler warnings.

          -1 findbugs. The patch appears to introduce 2 new Findbugs (version 1.3.9) warnings.

          +1 release audit. The applied patch does not increase the total number of release audit warnings.

          +1 core tests. The patch passed unit tests in .

          Test results: https://builds.apache.org/job/PreCommit-HBASE-Build/1706//testReport/
          Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/1706//artifact/trunk/patchprocess/newPatchFindbugsWarnings.html
          Console output: https://builds.apache.org/job/PreCommit-HBASE-Build/1706//console

          This message is automatically generated.

          Show
          Hadoop QA added a comment - -1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12525162/ruby_HBASE-5548-addendum.patch against trunk revision . +1 @author. The patch does not contain any @author tags. +1 tests included. The patch appears to include 12 new or modified tests. +1 hadoop23. The patch compiles against the hadoop 0.23.x profile. +1 javadoc. The javadoc tool did not generate any warning messages. +1 javac. The applied patch does not increase the total number of javac compiler warnings. -1 findbugs. The patch appears to introduce 2 new Findbugs (version 1.3.9) warnings. +1 release audit. The applied patch does not increase the total number of release audit warnings. +1 core tests. The patch passed unit tests in . Test results: https://builds.apache.org/job/PreCommit-HBASE-Build/1706//testReport/ Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/1706//artifact/trunk/patchprocess/newPatchFindbugsWarnings.html Console output: https://builds.apache.org/job/PreCommit-HBASE-Build/1706//console This message is automatically generated.
          Hide
          stack added a comment -

          Submitting addendum. Pardon my being zealous for this fancy new feature

          Show
          stack added a comment - Submitting addendum. Pardon my being zealous for this fancy new feature
          Hide
          Jesse Yates added a comment -

          fixes for tests and slight bugs. Passes on locally on OSX.

          Should be good for testing (and submit?).

          Show
          Jesse Yates added a comment - fixes for tests and slight bugs. Passes on locally on OSX. Should be good for testing (and submit?).
          Hide
          Hudson added a comment -

          Integrated in HBase-TRUNK-security #188 (See https://builds.apache.org/job/HBase-TRUNK-security/188/)
          HBASE-5548 Add ability to get a table in the shell (Revision 1332419)

          Result = FAILURE
          stack :
          Files :

          • /hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
          • /hbase/trunk/src/main/ruby/hbase/hbase.rb
          • /hbase/trunk/src/main/ruby/hbase/table.rb
          • /hbase/trunk/src/main/ruby/shell.rb
          • /hbase/trunk/src/main/ruby/shell/commands.rb
          • /hbase/trunk/src/main/ruby/shell/commands/count.rb
          • /hbase/trunk/src/main/ruby/shell/commands/create.rb
          • /hbase/trunk/src/main/ruby/shell/commands/delete.rb
          • /hbase/trunk/src/main/ruby/shell/commands/deleteall.rb
          • /hbase/trunk/src/main/ruby/shell/commands/get.rb
          • /hbase/trunk/src/main/ruby/shell/commands/get_counter.rb
          • /hbase/trunk/src/main/ruby/shell/commands/get_table.rb
          • /hbase/trunk/src/main/ruby/shell/commands/incr.rb
          • /hbase/trunk/src/main/ruby/shell/commands/put.rb
          • /hbase/trunk/src/main/ruby/shell/commands/scan.rb
          • /hbase/trunk/src/main/ruby/shell/commands/table_help.rb
          • /hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
          • /hbase/trunk/src/test/ruby/hbase/admin_test.rb
          Show
          Hudson added a comment - Integrated in HBase-TRUNK-security #188 (See https://builds.apache.org/job/HBase-TRUNK-security/188/ ) HBASE-5548 Add ability to get a table in the shell (Revision 1332419) Result = FAILURE stack : Files : /hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java /hbase/trunk/src/main/ruby/hbase/hbase.rb /hbase/trunk/src/main/ruby/hbase/table.rb /hbase/trunk/src/main/ruby/shell.rb /hbase/trunk/src/main/ruby/shell/commands.rb /hbase/trunk/src/main/ruby/shell/commands/count.rb /hbase/trunk/src/main/ruby/shell/commands/create.rb /hbase/trunk/src/main/ruby/shell/commands/delete.rb /hbase/trunk/src/main/ruby/shell/commands/deleteall.rb /hbase/trunk/src/main/ruby/shell/commands/get.rb /hbase/trunk/src/main/ruby/shell/commands/get_counter.rb /hbase/trunk/src/main/ruby/shell/commands/get_table.rb /hbase/trunk/src/main/ruby/shell/commands/incr.rb /hbase/trunk/src/main/ruby/shell/commands/put.rb /hbase/trunk/src/main/ruby/shell/commands/scan.rb /hbase/trunk/src/main/ruby/shell/commands/table_help.rb /hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java /hbase/trunk/src/test/ruby/hbase/admin_test.rb
          Hide
          Ted Yu added a comment -

          @Jesse:
          I checked the two outstanding Hadoop QA jobs around 23:27 - they were not for this JIRA.

          Show
          Ted Yu added a comment - @Jesse: I checked the two outstanding Hadoop QA jobs around 23:27 - they were not for this JIRA.
          Hide
          Jesse Yates added a comment -

          yeah, was waiting for the QA run on it... maybe we jumped the gun a little there (though TestShell has been always a little funky on my machine). Looking into the issue now.

          Show
          Jesse Yates added a comment - yeah, was waiting for the QA run on it... maybe we jumped the gun a little there (though TestShell has been always a little funky on my machine). Looking into the issue now.
          Hide
          Ted Yu added a comment -

          I don't see Hadoop QA report on this JIRA.
          I can reproduce the following test failure:

            testRunShellTests(org.apache.hadoop.hbase.client.TestShell): (RuntimeError) Shell unit tests failed. Check output file for details.
          
          Show
          Ted Yu added a comment - I don't see Hadoop QA report on this JIRA. I can reproduce the following test failure: testRunShellTests(org.apache.hadoop.hbase.client.TestShell): (RuntimeError) Shell unit tests failed. Check output file for details.
          Hide
          Hudson added a comment -

          Integrated in HBase-TRUNK #2828 (See https://builds.apache.org/job/HBase-TRUNK/2828/)
          HBASE-5548 Add ability to get a table in the shell (Revision 1332419)

          Result = FAILURE
          stack :
          Files :

          • /hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
          • /hbase/trunk/src/main/ruby/hbase/hbase.rb
          • /hbase/trunk/src/main/ruby/hbase/table.rb
          • /hbase/trunk/src/main/ruby/shell.rb
          • /hbase/trunk/src/main/ruby/shell/commands.rb
          • /hbase/trunk/src/main/ruby/shell/commands/count.rb
          • /hbase/trunk/src/main/ruby/shell/commands/create.rb
          • /hbase/trunk/src/main/ruby/shell/commands/delete.rb
          • /hbase/trunk/src/main/ruby/shell/commands/deleteall.rb
          • /hbase/trunk/src/main/ruby/shell/commands/get.rb
          • /hbase/trunk/src/main/ruby/shell/commands/get_counter.rb
          • /hbase/trunk/src/main/ruby/shell/commands/get_table.rb
          • /hbase/trunk/src/main/ruby/shell/commands/incr.rb
          • /hbase/trunk/src/main/ruby/shell/commands/put.rb
          • /hbase/trunk/src/main/ruby/shell/commands/scan.rb
          • /hbase/trunk/src/main/ruby/shell/commands/table_help.rb
          • /hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
          • /hbase/trunk/src/test/ruby/hbase/admin_test.rb
          Show
          Hudson added a comment - Integrated in HBase-TRUNK #2828 (See https://builds.apache.org/job/HBase-TRUNK/2828/ ) HBASE-5548 Add ability to get a table in the shell (Revision 1332419) Result = FAILURE stack : Files : /hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java /hbase/trunk/src/main/ruby/hbase/hbase.rb /hbase/trunk/src/main/ruby/hbase/table.rb /hbase/trunk/src/main/ruby/shell.rb /hbase/trunk/src/main/ruby/shell/commands.rb /hbase/trunk/src/main/ruby/shell/commands/count.rb /hbase/trunk/src/main/ruby/shell/commands/create.rb /hbase/trunk/src/main/ruby/shell/commands/delete.rb /hbase/trunk/src/main/ruby/shell/commands/deleteall.rb /hbase/trunk/src/main/ruby/shell/commands/get.rb /hbase/trunk/src/main/ruby/shell/commands/get_counter.rb /hbase/trunk/src/main/ruby/shell/commands/get_table.rb /hbase/trunk/src/main/ruby/shell/commands/incr.rb /hbase/trunk/src/main/ruby/shell/commands/put.rb /hbase/trunk/src/main/ruby/shell/commands/scan.rb /hbase/trunk/src/main/ruby/shell/commands/table_help.rb /hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java /hbase/trunk/src/test/ruby/hbase/admin_test.rb
          Hide
          stack added a comment -

          Committed to trunk after poking around with it for a while. It looks good. Thanks for the patch Jesse.

          Show
          stack added a comment - Committed to trunk after poking around with it for a while. It looks good. Thanks for the patch Jesse.
          Hide
          Jesse Yates added a comment -

          Attaching patch with fixes as per stack. Turns out the get issue was just a misspelling I didn't catch; think everything else is working.

          Also, this includes a slight refactor so the help text actually lives in the table class, not remotely in table_help.rb. If it was enough that I forgot where it lived, then others will too

          Should be good to go.

          Show
          Jesse Yates added a comment - Attaching patch with fixes as per stack. Turns out the get issue was just a misspelling I didn't catch; think everything else is working. Also, this includes a slight refactor so the help text actually lives in the table class, not remotely in table_help.rb. If it was enough that I forgot where it lived, then others will too Should be good to go.
          Hide
          Jesse Yates added a comment -

          Seems like an issue?

          yeah, I think so. Odd that I missed that, though I may have made some changes and not done all the testing I should have. I'll take a look.

          Also in the help, talks about a table reference without explaining what it is (there is no mention of what this is in the general help either it seems). It could be confusing talking about a 't' w/o saying where it came from?

          Yeah, that can be confusing. I'll clean it up a bit.

          In the rest of the shell columns are a combo of family and qualifier delimited by the ':'. You are changing that w/ the above.

          Fair enough, though I would argue this is cleaner, but I switch it over for this patch.

          Thanks for giving it a spin stack!

          Show
          Jesse Yates added a comment - Seems like an issue? yeah, I think so. Odd that I missed that, though I may have made some changes and not done all the testing I should have. I'll take a look. Also in the help, talks about a table reference without explaining what it is (there is no mention of what this is in the general help either it seems). It could be confusing talking about a 't' w/o saying where it came from? Yeah, that can be confusing. I'll clean it up a bit. In the rest of the shell columns are a combo of family and qualifier delimited by the ':'. You are changing that w/ the above. Fair enough, though I would argue this is cleaner, but I switch it over for this patch. Thanks for giving it a spin stack!
          Hide
          stack added a comment -

          Sorry Jesse for taking a while to get back to this. Patch looks good. I tried it some more and got this:

          hbase(main):011:0> t.put 'x', 'y:x', 'x'
          0 row(s) in 0.0110 seconds
          hbase(main):012:0> t.get 'x'
          COLUMN                                               CELL                                                                                                                                                   
          
          ERROR: undefined method `get_internal' for Hbase::Table - y:Hbase::Table
          
          Here is some help for this command:
          Get row or cell contents; pass table name, row, and optionally
          a dictionary of column(s), timestamp, timerange and versions. Examples:
          
            hbase> get 't1', 'r1'
            hbase> get 't1', 'r1', {TIMERANGE => [ts1, ts2]}
            hbase> get 't1', 'r1', {COLUMN => 'c1'}
            hbase> get 't1', 'r1', {COLUMN => ['c1', 'c2', 'c3']}
            hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1}
            hbase> get 't1', 'r1', {COLUMN => 'c1', TIMERANGE => [ts1, ts2], VERSIONS => 4}
            hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1, VERSIONS => 4}
            hbase> get 't1', 'r1', 'c1'
            hbase> get 't1', 'r1', 'c1', 'c2'
            hbase> get 't1', 'r1', ['c1', 'c2']
          
          The same commands also can be run on a table reference. Suppose you had a reference
          t to table 't1', the corresponding commands would be:
          
            hbase> t.get 'r1'
            hbase> t.get 'r1', {TIMERANGE => [ts1, ts2]}
            hbase> t.get 'r1', {COLUMN => 'c1'}
            hbase> t.get 'r1', {COLUMN => ['c1', 'c2', 'c3']}
            hbase> t.get 'r1', {COLUMN => 'c1', TIMESTAMP => ts1}
            hbase> t.get 'r1', {COLUMN => 'c1', TIMERANGE => [ts1, ts2], VERSIONS => 4}
            hbase> t.get 'r1', {COLUMN => 'c1', TIMESTAMP => ts1, VERSIONS => 4}
            hbase> t.get 'r1', 'c1'
            hbase> t.get 'r1', 'c1', 'c2'
            hbase> t.get 'r1', ['c1', 'c2']
          

          Seems like an issue?

          Also in the help, talks about a table reference without explaining what it is (there is no mention of what this is in the general help either it seems). It could be confusing talking about a 't' w/o saying where it came from?

          I like the output of t.help.

          This is odd though:

            hbase> t.put 'r', 'c', 'q', 'v'
           which puts a row 'r' with column family 'c', qualifier 'q' and value 'v' into table t.
          

          In the rest of the shell columns are a combo of family and qualifier delimited by the ':'. You are changing that w/ the above.

          Show
          stack added a comment - Sorry Jesse for taking a while to get back to this. Patch looks good. I tried it some more and got this: hbase(main):011:0> t.put 'x', 'y:x', 'x' 0 row(s) in 0.0110 seconds hbase(main):012:0> t.get 'x' COLUMN CELL ERROR: undefined method `get_internal' for Hbase::Table - y:Hbase::Table Here is some help for this command: Get row or cell contents; pass table name, row, and optionally a dictionary of column(s), timestamp, timerange and versions. Examples: hbase> get 't1', 'r1' hbase> get 't1', 'r1', {TIMERANGE => [ts1, ts2]} hbase> get 't1', 'r1', {COLUMN => 'c1'} hbase> get 't1', 'r1', {COLUMN => ['c1', 'c2', 'c3']} hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1} hbase> get 't1', 'r1', {COLUMN => 'c1', TIMERANGE => [ts1, ts2], VERSIONS => 4} hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1, VERSIONS => 4} hbase> get 't1', 'r1', 'c1' hbase> get 't1', 'r1', 'c1', 'c2' hbase> get 't1', 'r1', ['c1', 'c2'] The same commands also can be run on a table reference. Suppose you had a reference t to table 't1', the corresponding commands would be: hbase> t.get 'r1' hbase> t.get 'r1', {TIMERANGE => [ts1, ts2]} hbase> t.get 'r1', {COLUMN => 'c1'} hbase> t.get 'r1', {COLUMN => ['c1', 'c2', 'c3']} hbase> t.get 'r1', {COLUMN => 'c1', TIMESTAMP => ts1} hbase> t.get 'r1', {COLUMN => 'c1', TIMERANGE => [ts1, ts2], VERSIONS => 4} hbase> t.get 'r1', {COLUMN => 'c1', TIMESTAMP => ts1, VERSIONS => 4} hbase> t.get 'r1', 'c1' hbase> t.get 'r1', 'c1', 'c2' hbase> t.get 'r1', ['c1', 'c2'] Seems like an issue? Also in the help, talks about a table reference without explaining what it is (there is no mention of what this is in the general help either it seems). It could be confusing talking about a 't' w/o saying where it came from? I like the output of t.help. This is odd though: hbase> t.put 'r', 'c', 'q', 'v' which puts a row 'r' with column family 'c', qualifier 'q' and value 'v' into table t. In the rest of the shell columns are a combo of family and qualifier delimited by the ':'. You are changing that w/ the above.
          Hide
          Jesse Yates added a comment -

          Sooo, I guess no one has comments on it and we can roll it in? I know this isn't super crucial (likely causing the lack of reviews), but its been up for a while and would like to get it in.

          Show
          Jesse Yates added a comment - Sooo, I guess no one has comments on it and we can roll it in? I know this isn't super crucial (likely causing the lack of reviews), but its been up for a while and would like to get it in.
          Hide
          jiraposter@reviews.apache.org added a comment -

          -----------------------------------------------------------
          This is an automatically generated e-mail. To reply, visit:
          https://reviews.apache.org/r/4668/
          -----------------------------------------------------------

          Review request for hbase and Michael Stack.

          Summary
          -------

          Adding the ability to get a reference to a table in the shell.

          Previously, all commands that acted on a table would need to take the name of the table as a string, which is annoying in an OO REPL. This patch introduces the ability to get and hold a reference to a table both on creation (via create(...)) and at will (via get_table(...)).

          Further, to actually make the table useful, modifications to table specific class were made so you can have a reference and just do things like put, scan, get, etc. on that table reference. To accommodate new table functionality, table specific methods are easily added (one line) in a dynamic fashion via class methods in the Table. See examples in get, put, scan, etc..

          There is also a lot of admin functionality tied to a table - things like disabling, dropping, describing, etc - that were added to the table class. Now you can do things like 'table.disable' and 'table.describe'. Again these were dynamically added, so new admin functionality for a table is as simple as adding the method name to one line in the Table class.

          This addresses bug HBASE-5548.
          https://issues.apache.org/jira/browse/HBASE-5548

          Diffs


          src/main/ruby/hbase/hbase.rb 2c37840
          src/main/ruby/hbase/table.rb 41dcf21
          src/main/ruby/shell.rb 53f3de8
          src/main/ruby/shell/commands.rb af6df33
          src/main/ruby/shell/commands/count.rb 6596441
          src/main/ruby/shell/commands/create.rb 14c1b0f
          src/main/ruby/shell/commands/delete.rb 12bc405
          src/main/ruby/shell/commands/deleteall.rb 5731b60
          src/main/ruby/shell/commands/get.rb 754c3d6
          src/main/ruby/shell/commands/get_counter.rb 3cbe226
          src/main/ruby/shell/commands/get_table.rb PRE-CREATION
          src/main/ruby/shell/commands/incr.rb 38a2fc5
          src/main/ruby/shell/commands/put.rb dde0433
          src/main/ruby/shell/commands/scan.rb e58aaac
          src/main/ruby/shell/commands/table_help.rb PRE-CREATION
          src/test/ruby/hbase/admin_test.rb 0c2672b

          Diff: https://reviews.apache.org/r/4668/diff

          Testing
          -------

          Manual and basic unit tests.

          Thanks,

          Jesse

          Show
          jiraposter@reviews.apache.org added a comment - ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/4668/ ----------------------------------------------------------- Review request for hbase and Michael Stack. Summary ------- Adding the ability to get a reference to a table in the shell. Previously, all commands that acted on a table would need to take the name of the table as a string, which is annoying in an OO REPL. This patch introduces the ability to get and hold a reference to a table both on creation (via create(...)) and at will (via get_table(...)). Further, to actually make the table useful, modifications to table specific class were made so you can have a reference and just do things like put, scan, get, etc. on that table reference. To accommodate new table functionality, table specific methods are easily added (one line) in a dynamic fashion via class methods in the Table. See examples in get, put, scan, etc.. There is also a lot of admin functionality tied to a table - things like disabling, dropping, describing, etc - that were added to the table class. Now you can do things like 'table.disable' and 'table.describe'. Again these were dynamically added, so new admin functionality for a table is as simple as adding the method name to one line in the Table class. This addresses bug HBASE-5548 . https://issues.apache.org/jira/browse/HBASE-5548 Diffs src/main/ruby/hbase/hbase.rb 2c37840 src/main/ruby/hbase/table.rb 41dcf21 src/main/ruby/shell.rb 53f3de8 src/main/ruby/shell/commands.rb af6df33 src/main/ruby/shell/commands/count.rb 6596441 src/main/ruby/shell/commands/create.rb 14c1b0f src/main/ruby/shell/commands/delete.rb 12bc405 src/main/ruby/shell/commands/deleteall.rb 5731b60 src/main/ruby/shell/commands/get.rb 754c3d6 src/main/ruby/shell/commands/get_counter.rb 3cbe226 src/main/ruby/shell/commands/get_table.rb PRE-CREATION src/main/ruby/shell/commands/incr.rb 38a2fc5 src/main/ruby/shell/commands/put.rb dde0433 src/main/ruby/shell/commands/scan.rb e58aaac src/main/ruby/shell/commands/table_help.rb PRE-CREATION src/test/ruby/hbase/admin_test.rb 0c2672b Diff: https://reviews.apache.org/r/4668/diff Testing ------- Manual and basic unit tests. Thanks, Jesse
          Hide
          Jesse Yates added a comment -

          When I create a table, the output is kinda ugly? I suppose no way around it.... its not end of world.

          Doing a 360 on my comments above; looks like you can suppress it pretty easily, if not entirely cleanly. I'd rather not hack the irb too much, but just do it via changes to the methods on Table. Below is the output I have it using now.

          1.9.2-p290 :002 > t = get_table 't'
          0 row(s) in 0.0240 seconds
          
           =>Hbase::Table - t  
          1.9.2-p290 :003 >
          

          Essentially, we are just printing out the class and then the name of the table. If we wanted to do more complicated things (for instance, print the CFs for the table, or the whole descriptor) we can easily add it later to the Table.to_s method.

          Pretty clean and makes sense for people used to the ruby REPL as you see the value of what you just got back (as a string).

          I'm thinking it might be nice to add in some help specific to a table command more dynamically.

          Punting on this - doubt it is going to be very rare that we will have to mod the help for the command dynamically - you probably are changing the nature of the command, so its really not worth it at the moment.

          Show
          Jesse Yates added a comment - When I create a table, the output is kinda ugly? I suppose no way around it.... its not end of world. Doing a 360 on my comments above; looks like you can suppress it pretty easily, if not entirely cleanly. I'd rather not hack the irb too much, but just do it via changes to the methods on Table. Below is the output I have it using now. 1.9.2-p290 :002 > t = get_table 't' 0 row(s) in 0.0240 seconds =>Hbase::Table - t 1.9.2-p290 :003 > Essentially, we are just printing out the class and then the name of the table. If we wanted to do more complicated things (for instance, print the CFs for the table, or the whole descriptor) we can easily add it later to the Table.to_s method. Pretty clean and makes sense for people used to the ruby REPL as you see the value of what you just got back (as a string). I'm thinking it might be nice to add in some help specific to a table command more dynamically. Punting on this - doubt it is going to be very rare that we will have to mod the help for the command dynamically - you probably are changing the nature of the command, so its really not worth it at the moment.
          Hide
          Jesse Yates added a comment -

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

          Yeah, probably I'll add some comments in a follow on patch.

          When I create a table, the output is kinda ugly? I suppose no way around it.... its not end of world.

          You can by appending a ';' to the end of the line. But then you don't know if the operation is successful or not, as it suppresses all output. I tried a bunch of tricks to not show all that stuff, but nothing seemed to work. We can add a comment to the above effect in the guide.

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

          Yeah, that is the general put help. I'm thinking it might be nice to add in some help specific to a table command more dynamically. I'll look into it.

          thanks for the review stack! I'll get up a new patch and also throw it on RB (with associated release note) so others can take a look-see before rolling in the patch.

          Show
          Jesse Yates added a comment - I installed the patch, when I do general 'help', I see nothing on this new facility. I probably should? Yeah, probably I'll add some comments in a follow on patch. When I create a table, the output is kinda ugly? I suppose no way around it.... its not end of world. You can by appending a ';' to the end of the line. But then you don't know if the operation is successful or not, as it suppresses all output. I tried a bunch of tricks to not show all that stuff, but nothing seemed to work. We can add a comment to the above effect in the guide. If I do t.put, w/ wrong args it gives me the help but its general help rather than help for my table context Yeah, that is the general put help. I'm thinking it might be nice to add in some help specific to a table command more dynamically. I'll look into it. thanks for the review stack! I'll get up a new patch and also throw it on RB (with associated release note) so others can take a look-see before rolling in the patch.
          Hide
          stack added a comment -

          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:

          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"
          

          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:

          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
          

          This stuff works though:

          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   
          
          Show
          stack added a comment - 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: 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" 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: 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 This stuff works though: 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
          Hide
          Jesse Yates added a comment -

          Updated patch with:

          • more commenting!
          • updates for all the table commands
          • addition of admin utilities on a table (e.g. flush, enable, disable and drop)

          Think this is ready (and large enough to RB). thoughts?

          Show
          Jesse Yates added a comment - Updated patch with: more commenting! updates for all the table commands addition of admin utilities on a table (e.g. flush, enable, disable and drop) Think this is ready (and large enough to RB). thoughts?
          Hide
          Jesse Yates added a comment -

          You are doing call by String methodname. It makes it all a bit more brittle

          Indeed, but its how we do everything else in the shell, so I didn't think it would be so bad.

          Whats an exception look like if you pass an unknown 'command'. Is it intelligible?

          Ends up spitting out this:

          NoMethodError: undefined method `new' for nil:NilClass
          

          So not really - I'll clean it up.

          Needs lots of comments explaining whats going on.

          I'll work on it - anything in particular odd?

          Show
          Jesse Yates added a comment - You are doing call by String methodname. It makes it all a bit more brittle Indeed, but its how we do everything else in the shell, so I didn't think it would be so bad. Whats an exception look like if you pass an unknown 'command'. Is it intelligible? Ends up spitting out this: NoMethodError: undefined method ` new ' for nil:NilClass So not really - I'll clean it up. Needs lots of comments explaining whats going on. I'll work on it - anything in particular odd?
          Hide
          Jesse Yates added a comment -

          Was planning on getting it the code up on RB tonight, but I guess for reviews it would take a couple days. If its not done on time, 0.94.1 would be acceptable. But 0.94 up since that was what we were thinking as per the discussion on HBASE-5592.

          Show
          Jesse Yates added a comment - Was planning on getting it the code up on RB tonight, but I guess for reviews it would take a couple days. If its not done on time, 0.94.1 would be acceptable. But 0.94 up since that was what we were thinking as per the discussion on HBASE-5592 .
          Hide
          Lars Hofhansl added a comment -

          @Jesse: What's your feeling here. 0.94? Means it needs to be done in a day or two.

          Show
          Lars Hofhansl added a comment - @Jesse: What's your feeling here. 0.94? Means it needs to be done in a day or two.
          Hide
          stack added a comment -

          You are doing call by String methodname. It makes it all a bit more brittle but there is only the one code path so its grokable. Whats an exception look like if you pass an unknown 'command'. Is it intelligible? I don't think you have any other choice. Looks good to me as a direction. Needs lots of comments explaining whats going on.

          Show
          stack added a comment - You are doing call by String methodname. It makes it all a bit more brittle but there is only the one code path so its grokable. Whats an exception look like if you pass an unknown 'command'. Is it intelligible? I don't think you have any other choice. Looks good to me as a direction. Needs lots of comments explaining whats going on.
          Hide
          Jesse Yates added a comment -

          Waiting on your comments as to if you liked the design of the current patch, with the addition of the table methods via class-reopening and with the internal vs external method stuff, etc. If you are happy, then I'll do the rest of the table commands (put, get, etc.) in the same style and throw a patch up on RB tonight so everyone gets a chance to look.

          Show
          Jesse Yates added a comment - Waiting on your comments as to if you liked the design of the current patch, with the addition of the table methods via class-reopening and with the internal vs external method stuff, etc. If you are happy, then I'll do the rest of the table commands (put, get, etc.) in the same style and throw a patch up on RB tonight so everyone gets a chance to look.
          Hide
          stack added a comment -

          You going to upload new patch Jesse or this is good to go?
          St.Ack

          Show
          stack added a comment - You going to upload new patch Jesse or this is good to go? St.Ack
          Hide
          Jesse Yates added a comment -

          You pass in the shell instance now instead of formatter when we create a table instance. Do we get the formatter to use from the shell?

          Turns out passing in the formatter was cruft - we weren't actually using it. The shell is passed in here so we can use it to do 'good' help output (referencing individual methods).

          For the help, we print out a tail 'Access an HTable....' every time whatever the help asked for. Is this right? Should we only print out this 'Access an HTable....' stuff if nothing is passed to the table help method?

          It shouldn't be running every time - bug if it is. The lines:

          +      if command
          +        return @shell.help_command(command)
          +      end
          +      return <<-EOF
          

          ensures that only if they don't pass in a command name, that we print out the 'Access an HTable...' lines (note the if...return, end. If you do match the if, then run the help for that command, else print out the general table help. Just a little cleaner to drop the else).

          The above comment doesn't run right?

          Nope, but thought it would be good to leave in there for future shell-hackers. This was a big step in my understanding of what is going on.

          Thanks for feedback stack!

          Show
          Jesse Yates added a comment - You pass in the shell instance now instead of formatter when we create a table instance. Do we get the formatter to use from the shell? Turns out passing in the formatter was cruft - we weren't actually using it. The shell is passed in here so we can use it to do 'good' help output (referencing individual methods). For the help, we print out a tail 'Access an HTable....' every time whatever the help asked for. Is this right? Should we only print out this 'Access an HTable....' stuff if nothing is passed to the table help method? It shouldn't be running every time - bug if it is. The lines: + if command + return @shell.help_command(command) + end + return <<-EOF ensures that only if they don't pass in a command name, that we print out the 'Access an HTable...' lines (note the if...return, end. If you do match the if, then run the help for that command, else print out the general table help. Just a little cleaner to drop the else). The above comment doesn't run right? Nope, but thought it would be good to leave in there for future shell-hackers. This was a big step in my understanding of what is going on. Thanks for feedback stack!
          Hide
          stack added a comment -

          You pass in the shell instance now instead of formatter when we create a table instance. Do we get the formatter to use from the shell?

          For the help, we print out a tail 'Access an HTable....' every time whatever the help asked for. Is this right? Should we only print out this 'Access an HTable....' stuff if nothing is passed to the table help method?

          +        # here where is the IRB namespace
          +        # this method just adds the call to the specified command
          

          The above comment doesn't run right?

          Otherwise, patch looks good (I think – smile). Let me try it.

          Show
          stack added a comment - You pass in the shell instance now instead of formatter when we create a table instance. Do we get the formatter to use from the shell? For the help, we print out a tail 'Access an HTable....' every time whatever the help asked for. Is this right? Should we only print out this 'Access an HTable....' stuff if nothing is passed to the table help method? + # here where is the IRB namespace + # this method just adds the call to the specified command The above comment doesn't run right? Otherwise, patch looks good (I think – smile). Let me try it.
          Hide
          Jesse Yates added a comment -

          Oh, and for completeness, here is what the output now looks like:

          1.9.2-p290 :002 > list
          TABLE                                                                                                            
          0 row(s) in 0.0300 seconds
          
          1.9.2-p290 :003 > t = create 't', 'f'
          0 row(s) in 1.0970 seconds
          
           => #<Hbase::Table:0x6601879b @table=#<Java::OrgApacheHadoopHbaseClient::HTable:0x5b489c06>, @shell=#<Shell::Shell:0x3bba1894 @formatter=#<Shell::Formatter::Console:0x36a3bb2e @out=Kernel, @row_count=0, @max_width=113>, @hbase_admin=#<Hbase::Admin:0x3755e508 @zk_wrapper=#<#<Class:0x682f8c99>:0x45ed957d>, @zk_main=#<Java::OrgApacheZookeeper::ZooKeeperMain:0x385715>, @formatter=#<Shell::Formatter::Console:0x36a3bb2e @out=Kernel, @row_count=0, @max_width=113>, @conf=#<Java::OrgApacheHadoopConf::Configuration:0x73c28517>, @admin=#<Java::OrgApacheHadoopHbaseClient::HBaseAdmin:0x2a717ef5>>, @hbase=#<Hbase::Hbase:0x21ff3fcf @configuration=#<Java::OrgApacheHadoopConf::Configuration:0x73c28517>>>> 
          1.9.2-p290 :004 > t.put 'r', 'f', 'v'
          1.9.2-p290 :005 > t.scan
          ROW                           COLUMN+CELL                                                                        
           r                            column=f:, timestamp=1331865816290, value=v                                        
          1 row(s) in 0.0520 seconds
          1.9.2-p290 :006 > t.help 'scan'
          Scan a table; pass table name and optionally a dictionary of scanner
          specifications.  Scanner specifications may include one or more of:
          TIMERANGE, FILTER, LIMIT, STARTROW, STOPROW, TIMESTAMP, MAXLENGTH,
          or COLUMNS.
          
          If no columns are specified, all columns will be scanned.
          To scan all members of a column family, leave the qualifier empty as in
          'col_family:'.
          
          The filter can be specified in two ways:
          1. Using a filterString - more information on this is available in the
          Filter Language document attached to the HBASE-4176 JIRA
          2. Using the entire package name of the filter.
          
          Some examples:
          
            hbase> scan '.META.'
            hbase> scan '.META.', {COLUMNS => 'info:regioninfo'}
            hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'}
            hbase> scan 't1', {COLUMNS => 'c1', TIMERANGE => [1303668804, 1303668904]}
            hbase> scan 't1', {FILTER => "(PrefixFilter ('row2') AND (QualifierFilter (>=, 'binary:xyz'))) AND (TimestampsFilter ( 123, 456))"}
            hbase> scan 't1', {FILTER => org.apache.hadoop.hbase.filter.ColumnPaginationFilter.new(1, 0)}
          
          For experts, there is an additional option -- CACHE_BLOCKS -- which
          switches block caching for the scanner on (true) or off (false).  By
          default it is enabled.  Examples:
          
            hbase> scan 't1', {COLUMNS => ['c1', 'c2'], CACHE_BLOCKS => false}
          
          Also for experts, there is an advanced option -- RAW -- which instructs the
          scanner to return all cells (including delete markers and uncollected deleted
          cells). This option cannot be combined with requesting specific COLUMNS.
          Disabled by default.  Example:
          
            hbase> scan 't1', {RAW => true, VERSIONS => 10}
          
          Scan can also be used directly from a table, by first getting a reference to a table, like such:
          
            hbase> t = get_table 't'
            hbase> t.scan
          
          Note in the above situation, you can still provide all the filtering, columns, options, etc as
          described above.
          1.9.2-p290 :007 >
          
          Show
          Jesse Yates added a comment - Oh, and for completeness, here is what the output now looks like: 1.9.2-p290 :002 > list TABLE 0 row(s) in 0.0300 seconds 1.9.2-p290 :003 > t = create 't', 'f' 0 row(s) in 1.0970 seconds => #<Hbase::Table:0x6601879b @table=#<Java::OrgApacheHadoopHbaseClient::HTable:0x5b489c06>, @shell=#<Shell::Shell:0x3bba1894 @formatter=#<Shell::Formatter::Console:0x36a3bb2e @out=Kernel, @row_count=0, @max_width=113>, @hbase_admin=#<Hbase::Admin:0x3755e508 @zk_wrapper=#<#< Class :0x682f8c99>:0x45ed957d>, @zk_main=#<Java::OrgApacheZookeeper::ZooKeeperMain:0x385715>, @formatter=#<Shell::Formatter::Console:0x36a3bb2e @out=Kernel, @row_count=0, @max_width=113>, @conf=#<Java::OrgApacheHadoopConf::Configuration:0x73c28517>, @admin=#<Java::OrgApacheHadoopHbaseClient::HBaseAdmin:0x2a717ef5>>, @hbase=#<Hbase::Hbase:0x21ff3fcf @configuration=#<Java::OrgApacheHadoopConf::Configuration:0x73c28517>>>> 1.9.2-p290 :004 > t.put 'r', 'f', 'v' 1.9.2-p290 :005 > t.scan ROW COLUMN+CELL r column=f:, timestamp=1331865816290, value=v 1 row(s) in 0.0520 seconds 1.9.2-p290 :006 > t.help 'scan' Scan a table; pass table name and optionally a dictionary of scanner specifications. Scanner specifications may include one or more of: TIMERANGE, FILTER, LIMIT, STARTROW, STOPROW, TIMESTAMP, MAXLENGTH, or COLUMNS. If no columns are specified, all columns will be scanned. To scan all members of a column family, leave the qualifier empty as in 'col_family:'. The filter can be specified in two ways: 1. Using a filterString - more information on this is available in the Filter Language document attached to the HBASE-4176 JIRA 2. Using the entire package name of the filter. Some examples: hbase> scan '.META.' hbase> scan '.META.', {COLUMNS => 'info:regioninfo'} hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'} hbase> scan 't1', {COLUMNS => 'c1', TIMERANGE => [1303668804, 1303668904]} hbase> scan 't1', {FILTER => "(PrefixFilter ('row2') AND (QualifierFilter (>=, 'binary:xyz'))) AND (TimestampsFilter ( 123, 456))" } hbase> scan 't1', {FILTER => org.apache.hadoop.hbase.filter.ColumnPaginationFilter. new (1, 0)} For experts, there is an additional option -- CACHE_BLOCKS -- which switches block caching for the scanner on ( true ) or off ( false ). By default it is enabled. Examples: hbase> scan 't1', {COLUMNS => ['c1', 'c2'], CACHE_BLOCKS => false } Also for experts, there is an advanced option -- RAW -- which instructs the scanner to return all cells (including delete markers and uncollected deleted cells). This option cannot be combined with requesting specific COLUMNS. Disabled by default . Example: hbase> scan 't1', {RAW => true , VERSIONS => 10} Scan can also be used directly from a table, by first getting a reference to a table, like such: hbase> t = get_table 't' hbase> t.scan Note in the above situation, you can still provide all the filtering, columns, options, etc as described above. 1.9.2-p290 :007 >
          Hide
          Jesse Yates added a comment -

          Went back and forth a bunch on how I wanted to implement this (including coding up a couple different versions), hence the few days its taken me to get this patch up.

          Went with the current model as it helps keep concerns separate - table just does the internal work of how to do scans, puts, etc (the latter to be impl), and passes on the formatting work and specific help implementations to the command instances.

          To get here, had to add the ability to call a command by name in the Shell class, hence the internal_command method, but actually reuses most of the current support, even when calling the method from the table (safe views of commands, etc).

          Final consideration: we may want to add a method to the command class so a command instance can add the ability to add a method to a table more easily, instead of having to add the section seen at the bottom of ::Commands::Scan, where we open back up the Table class.

          Thoughts? Or is that work minimal enough to justify for adding new commands?

          If we are happy with this, I'll port the other table commands to this new model and post up a patch for review.

          For completeness, the other major options considered:

          • have table do all the formatting,etc now handled by the commands
            • side effect - commands are pretty useless except for help and is a pretty big rewrite and require the table to get a formmater as well as an instance of each command
            • bonus - methods like scan_internal can be made private
          • similar to this patch, but have the command on load register itself with the table so can do help
            • minus - lots of reproduced functionality like what the Shell is currently doing with loading commands. Also, don't gain much and same problems as above
            • bonus - code is a bit more centralized
          Show
          Jesse Yates added a comment - Went back and forth a bunch on how I wanted to implement this (including coding up a couple different versions), hence the few days its taken me to get this patch up. Went with the current model as it helps keep concerns separate - table just does the internal work of how to do scans, puts, etc (the latter to be impl), and passes on the formatting work and specific help implementations to the command instances. To get here, had to add the ability to call a command by name in the Shell class, hence the internal_command method, but actually reuses most of the current support, even when calling the method from the table (safe views of commands, etc). Final consideration: we may want to add a method to the command class so a command instance can add the ability to add a method to a table more easily, instead of having to add the section seen at the bottom of ::Commands::Scan, where we open back up the Table class. Thoughts? Or is that work minimal enough to justify for adding new commands? If we are happy with this, I'll port the other table commands to this new model and post up a patch for review. For completeness, the other major options considered: have table do all the formatting,etc now handled by the commands side effect - commands are pretty useless except for help and is a pretty big rewrite and require the table to get a formmater as well as an instance of each command bonus - methods like scan_internal can be made private similar to this patch, but have the command on load register itself with the table so can do help minus - lots of reproduced functionality like what the Shell is currently doing with loading commands. Also, don't gain much and same problems as above bonus - code is a bit more centralized
          Hide
          Jesse Yates added a comment -

          get 'tablename', 'yadda', 'yadda'....

          Yeah, nothing changes there. In fact, scan (which is the only change that patch introduces) still will work exactly the same way. Same deal for doing something like t.scan

          On get_table, should it just be table? 'status' dumps out status, 'version', dumps out 'version'. Maybe it should stay get_table, because it returns something you can catch into a variable?

          I was thinking it should stay get_table since table will be clutter the overall naming a little (Table is also the name of the ::Hbase::Table class) and yeah, it implies holding a reference, which all the other commands don't give you. I would imagine doing

          t = table 't1'
          

          as actually creating the table if it doesn't exist, or just getting a reference to it (similar to how 'create' works in the latest patch). A follow-on patch would be nice there.

          I want to think about the 'right' way to do the extension of ::Hbase::Table, rather than this piecemeal, method-by-method, decentralized increase. Also, adding the same type of system for put, get, delete, etc would be nice. But, yeah, close!

          Show
          Jesse Yates added a comment - get 'tablename', 'yadda', 'yadda'.... Yeah, nothing changes there. In fact, scan (which is the only change that patch introduces) still will work exactly the same way. Same deal for doing something like t.scan On get_table, should it just be table? 'status' dumps out status, 'version', dumps out 'version'. Maybe it should stay get_table, because it returns something you can catch into a variable? I was thinking it should stay get_table since table will be clutter the overall naming a little (Table is also the name of the ::Hbase::Table class) and yeah, it implies holding a reference, which all the other commands don't give you. I would imagine doing t = table 't1' as actually creating the table if it doesn't exist, or just getting a reference to it (similar to how 'create' works in the latest patch). A follow-on patch would be nice there. I want to think about the 'right' way to do the extension of ::Hbase::Table, rather than this piecemeal, method-by-method, decentralized increase. Also, adding the same type of system for put, get, delete, etc would be nice. But, yeah, close!
          Hide
          stack added a comment -

          Looks good.

          Does stuff work as it used to after this patch goes in? Can you do the old dumb:

          get 'tablename', 'yadda', 'yadda'....

          still?

          On get_table, should it just be table? 'status' dumps out status, 'version', dumps out 'version'. Maybe it should stay get_table, because it returns something you can catch into a variable?

          Oh, this is nice:

          +  hbase> t1 = create 't1', 'f1'
          

          How do i add a filter? Is it the same old: t.scan,

          {STARTROW => 'xyz'}

          or something?

          Patch is looking good I think. Introduces a nice bit of functionality...

          Show
          stack added a comment - Looks good. Does stuff work as it used to after this patch goes in? Can you do the old dumb: get 'tablename', 'yadda', 'yadda'.... still? On get_table, should it just be table? 'status' dumps out status, 'version', dumps out 'version'. Maybe it should stay get_table, because it returns something you can catch into a variable? Oh, this is nice: + hbase> t1 = create 't1', 'f1' How do i add a filter? Is it the same old: t.scan, {STARTROW => 'xyz'} or something? Patch is looking good I think. Introduces a nice bit of functionality...
          Hide
          Jesse Yates added a comment -

          Attaching patch...
          1) Fixed stack's comments
          2) Added features:

          • create now returns the table that was created
          • scan now dynamically adds a scan method to htable

          The latter makes sure that the table will output a scan 'nicely', and could be a decent paradigm for adding methods to the Table class (though probably some cleanup needs to be done as far as aliasing methods etc.). Thoughts on this new style?

          Also, here is the output from some usage:

          1.9.2-p290 :006 > t = create 't', 'f'
          0 row(s) in 1.0470 seconds
          
           => #<Hbase::Table:0x55187eb3 @table=#<Java::OrgApacheHadoopHbaseClient::HTable:0x92524b0>, @shell=#<Shell::Shell:0x329b5c95 @formatter=#<Shell::Formatter::Console:0x75db5427 @out=Kernel, @row_count=0, @max_width=80>, @hbase_admin=#<Hbase::Admin:0x127208e4 @zk_wrapper=#<Java::OrgApacheHadoopHbaseZookeeper::ZooKeeperWatcher:0xcb80017>, @zk_main=#<Java::OrgApacheZookeeper::ZooKeeperMain:0x646326e5>, @formatter=#<Shell::Formatter::Console:0x75db5427 @out=Kernel, @row_count=0, @max_width=80>, @conf=#<Java::OrgApacheHadoopConf::Configuration:0x4332b67c>, @admin=#<Java::OrgApacheHadoopHbaseClient::HBaseAdmin:0x2fbb3e9a>>, @hbase=#<Hbase::Hbase:0x56781dd4 @configuration=#<Java::OrgApacheHadoopConf::Configuration:0x4332b67c>>>> 
          1.9.2-p290 :007 > t.put 'r', 'f', 'v'
          1.9.2-p290 :008 > t1 = get_table 't'
          0 row(s) in 0.0240 seconds
          
           => #<Hbase::Table:0x7194f467 @table=#<Java::OrgApacheHadoopHbaseClient::HTable:0x6a39d072>, @shell=#<Shell::Shell:0x329b5c95 @formatter=#<Shell::Formatter::Console:0x75db5427 @out=Kernel, @row_count=0, @max_width=80>, @hbase_admin=#<Hbase::Admin:0x127208e4 @zk_wrapper=#<Java::OrgApacheHadoopHbaseZookeeper::ZooKeeperWatcher:0xcb80017>, @zk_main=#<Java::OrgApacheZookeeper::ZooKeeperMain:0x646326e5>, @formatter=#<Shell::Formatter::Console:0x75db5427 @out=Kernel, @row_count=0, @max_width=80>, @conf=#<Java::OrgApacheHadoopConf::Configuration:0x4332b67c>, @admin=#<Java::OrgApacheHadoopHbaseClient::HBaseAdmin:0x2fbb3e9a>>, @hbase=#<Hbase::Hbase:0x56781dd4 @configuration=#<Java::OrgApacheHadoopConf::Configuration:0x4332b67c>>>> 
          1.9.2-p290 :009 > t.put 'r2', 'f', 'v'
          1.9.2-p290 :010 > t.scan
          ROW                   COLUMN+CELL                                               
           r                    column=f:, timestamp=1331521351836, value=v               
           r2                   column=f:, timestamp=1331521368969, value=v               
          2 row(s) in 0.0870 seconds
          
          Show
          Jesse Yates added a comment - Attaching patch... 1) Fixed stack's comments 2) Added features: create now returns the table that was created scan now dynamically adds a scan method to htable The latter makes sure that the table will output a scan 'nicely', and could be a decent paradigm for adding methods to the Table class (though probably some cleanup needs to be done as far as aliasing methods etc.). Thoughts on this new style? Also, here is the output from some usage: 1.9.2-p290 :006 > t = create 't', 'f' 0 row(s) in 1.0470 seconds => #<Hbase::Table:0x55187eb3 @table=#<Java::OrgApacheHadoopHbaseClient::HTable:0x92524b0>, @shell=#<Shell::Shell:0x329b5c95 @formatter=#<Shell::Formatter::Console:0x75db5427 @out=Kernel, @row_count=0, @max_width=80>, @hbase_admin=#<Hbase::Admin:0x127208e4 @zk_wrapper=#<Java::OrgApacheHadoopHbaseZookeeper::ZooKeeperWatcher:0xcb80017>, @zk_main=#<Java::OrgApacheZookeeper::ZooKeeperMain:0x646326e5>, @formatter=#<Shell::Formatter::Console:0x75db5427 @out=Kernel, @row_count=0, @max_width=80>, @conf=#<Java::OrgApacheHadoopConf::Configuration:0x4332b67c>, @admin=#<Java::OrgApacheHadoopHbaseClient::HBaseAdmin:0x2fbb3e9a>>, @hbase=#<Hbase::Hbase:0x56781dd4 @configuration=#<Java::OrgApacheHadoopConf::Configuration:0x4332b67c>>>> 1.9.2-p290 :007 > t.put 'r', 'f', 'v' 1.9.2-p290 :008 > t1 = get_table 't' 0 row(s) in 0.0240 seconds => #<Hbase::Table:0x7194f467 @table=#<Java::OrgApacheHadoopHbaseClient::HTable:0x6a39d072>, @shell=#<Shell::Shell:0x329b5c95 @formatter=#<Shell::Formatter::Console:0x75db5427 @out=Kernel, @row_count=0, @max_width=80>, @hbase_admin=#<Hbase::Admin:0x127208e4 @zk_wrapper=#<Java::OrgApacheHadoopHbaseZookeeper::ZooKeeperWatcher:0xcb80017>, @zk_main=#<Java::OrgApacheZookeeper::ZooKeeperMain:0x646326e5>, @formatter=#<Shell::Formatter::Console:0x75db5427 @out=Kernel, @row_count=0, @max_width=80>, @conf=#<Java::OrgApacheHadoopConf::Configuration:0x4332b67c>, @admin=#<Java::OrgApacheHadoopHbaseClient::HBaseAdmin:0x2fbb3e9a>>, @hbase=#<Hbase::Hbase:0x56781dd4 @configuration=#<Java::OrgApacheHadoopConf::Configuration:0x4332b67c>>>> 1.9.2-p290 :009 > t.put 'r2', 'f', 'v' 1.9.2-p290 :010 > t.scan ROW COLUMN+CELL r column=f:, timestamp=1331521351836, value=v r2 column=f:, timestamp=1331521368969, value=v 2 row(s) in 0.0870 seconds
          Hide
          Jesse Yates added a comment -
          +        #define the command name in 'where' namespace
          +        #which actually just delegates to the shell instance
          

          The 'where' namespace is just the variable name, which in our case is the IRB shell namespace. However, internally, hirb just has a reference to the an instance of the Shell class, to which it is delegating all the calls. I'll fix the commenting to make it clearer.

          +        ret = translate_hbase_exceptions(*args) { command(*args) }
          +        return ret
          

          Yeah, that is just cruft from debugging, where I dumping some output in the middle.

          I don't see table.help. Is it missing from this patch?

          Yeah, completely forgot to implement it I'll put it into the next version. There are still some issues around hiding methods, since we do actually get autocomplete, which is nice. I'm also working on a version that will format the output (as opposed to the raw stuff we see from a scan below).

          Here is what some shell output looks like with the current patch:

          1.9.2-p290 :001 > create 't', 'f'
          0 row(s) in 1.7060 seconds
          
          1.9.2-p290 :002 > t = get_table 't'
          0 row(s) in 0.0770 seconds
          
           => #<Hbase::Table:0x6c6742d0 @table=#<Java::OrgApacheHadoopHbaseClient::HTable:0x59046270>> 
          1.9.2-p290 :003 > t.put 'r', 'f', 'value'
          1.9.2-p290 :004 > t.scan
           => {"r"=>{"f:"=>"timestamp=1331353365816, value=value"}} 
          
          Show
          Jesse Yates added a comment - + #define the command name in 'where' namespace + #which actually just delegates to the shell instance The 'where' namespace is just the variable name, which in our case is the IRB shell namespace. However, internally, hirb just has a reference to the an instance of the Shell class, to which it is delegating all the calls. I'll fix the commenting to make it clearer. + ret = translate_hbase_exceptions(*args) { command(*args) } + return ret Yeah, that is just cruft from debugging, where I dumping some output in the middle. I don't see table.help. Is it missing from this patch? Yeah, completely forgot to implement it I'll put it into the next version. There are still some issues around hiding methods, since we do actually get autocomplete, which is nice. I'm also working on a version that will format the output (as opposed to the raw stuff we see from a scan below). Here is what some shell output looks like with the current patch: 1.9.2-p290 :001 > create 't', 'f' 0 row(s) in 1.7060 seconds 1.9.2-p290 :002 > t = get_table 't' 0 row(s) in 0.0770 seconds => #<Hbase::Table:0x6c6742d0 @table=#<Java::OrgApacheHadoopHbaseClient::HTable:0x59046270>> 1.9.2-p290 :003 > t.put 'r', 'f', 'value' 1.9.2-p290 :004 > t.scan => { "r" =>{ "f:" => "timestamp=1331353365816, value=value" }}
          Hide
          stack added a comment -

          I don't get this comment:

          +        #define the command name in 'where' namespace
          +        #which actually just delegates to the shell instance
          

          Instead of

          +        ret = translate_hbase_exceptions(*args) { command(*args) }
          +        return ret
          

          .. why not just

          +        return translate_hbase_exceptions(*args) { command(*args) }
          

          Don't need this anymore

          +# Copyright 2010 The Apache Software Foundation

          I don't see table.help. Is it missing from this patch?

          Can you include snippet of a session using this new facility in shell?

          Good on you Jesse

          Show
          stack added a comment - I don't get this comment: + #define the command name in 'where' namespace + #which actually just delegates to the shell instance Instead of + ret = translate_hbase_exceptions(*args) { command(*args) } + return ret .. why not just + return translate_hbase_exceptions(*args) { command(*args) } Don't need this anymore +# Copyright 2010 The Apache Software Foundation I don't see table.help. Is it missing from this patch? Can you include snippet of a session using this new facility in shell? Good on you Jesse
          Hide
          Jesse Yates added a comment -

          Initial cut at this ticket. Its a little unclean as we don't have a nice way to isolate the java methods from the ruby methods and absolutely zero formatting from the output of the different commands as that is currently handled by the individual 'command' implementations.

          Show
          Jesse Yates added a comment - Initial cut at this ticket. Its a little unclean as we don't have a nice way to isolate the java methods from the ruby methods and absolutely zero formatting from the output of the different commands as that is currently handled by the individual 'command' implementations.

            People

            • Assignee:
              Jesse Yates
              Reporter:
              Jesse Yates
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development