HBase
  1. HBase
  2. HBASE-8298

In shell, provide alias of 'desc' for 'describe'

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 0.94.2
    • Fix Version/s: 0.99.0, 2.0.0, 0.98.6
    • Component/s: shell
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      It would be nice if you could type

      desc <tablename>

      in hbase shell as shorthand for

      describe <tablename>

      similar to how you can in traditional databases.

      1. desc.patch
        1 kB
        Hari Sekhon
      2. desc2.patch
        0.8 kB
        Hari Sekhon
      3. HBASE-8298-v3.patch
        2 kB
        Sean Busbey

        Activity

        Hide
        Jean-Marc Spaggiari added a comment -

        Hari Sekhon are you going to provide a patch for that?

        Show
        Jean-Marc Spaggiari added a comment - Hari Sekhon are you going to provide a patch for that?
        Hide
        Hari Sekhon added a comment -

        Here is the patch for the desc command in HBase shell. I tested on HBase 0.94.6-cdh4.3.0 and then rebuilt the patch against Apache HBase git trunk just now.

        Show
        Hari Sekhon added a comment - Here is the patch for the desc command in HBase shell. I tested on HBase 0.94.6-cdh4.3.0 and then rebuilt the patch against Apache HBase git trunk just now.
        Hide
        Hari Sekhon added a comment -

        I've attached the patch for the desc command in HBase shell. I tested on HBase 0.94.6-cdh4.3.0 and then rebuilt the patch against Apache HBase git trunk just now.

        Show
        Hari Sekhon added a comment - I've attached the patch for the desc command in HBase shell. I tested on HBase 0.94.6-cdh4.3.0 and then rebuilt the patch against Apache HBase git trunk just now.
        Hide
        stack added a comment -

        Thanks Hari Sekhon. You'd think there would be a better way to do this than have to create a new Command .rb file. Could the list of commands be a regex of something? Seems like something you could do in ruby? Doing it this way when you list the commands available, will describe and desc both show? That might confuse?

        Show
        stack added a comment - Thanks Hari Sekhon . You'd think there would be a better way to do this than have to create a new Command .rb file. Could the list of commands be a regex of something? Seems like something you could do in ruby? Doing it this way when you list the commands available, will describe and desc both show? That might confuse?
        Hide
        Hari Sekhon added a comment -

        Yes that would appear in the help command in the ddl command group next to describe, although it shouldn't be confusing since desc is the widely known common shortcut for describe across various systems and I've intentionally inherited from Describe so the help documentation and implementation is exactly the same and will inherit any changes made to Describe in the future.

        Right now the code wouldn't support a regex without a more significant rewrite of the hbase shell. It's all pre-defined command lists which are just dynamically eval'ing the command files for the command classes containing the actual command method for the action. A regex wouldn't know where to find the actual class definitions.

        If you leave desc off the pre-defined command list it never loads the desc class. Even if you move the Desc class to describe.rb which is loaded you don't get the command mapping and end up with an error "NoMethodError: undefined method..."

        The command mapping is a class inheritance variable in the base Shell module, so the only other reasonably easy way that I can see to do this would be to add a special case in the base Shell module, which is slightly more hackish way of doing it and not in keeping with the current command framework, although the desc command will not show in the ddl group for help, it'll be a stealth shortcut.

        Show
        Hari Sekhon added a comment - Yes that would appear in the help command in the ddl command group next to describe, although it shouldn't be confusing since desc is the widely known common shortcut for describe across various systems and I've intentionally inherited from Describe so the help documentation and implementation is exactly the same and will inherit any changes made to Describe in the future. Right now the code wouldn't support a regex without a more significant rewrite of the hbase shell. It's all pre-defined command lists which are just dynamically eval'ing the command files for the command classes containing the actual command method for the action. A regex wouldn't know where to find the actual class definitions. If you leave desc off the pre-defined command list it never loads the desc class. Even if you move the Desc class to describe.rb which is loaded you don't get the command mapping and end up with an error "NoMethodError: undefined method..." The command mapping is a class inheritance variable in the base Shell module, so the only other reasonably easy way that I can see to do this would be to add a special case in the base Shell module, which is slightly more hackish way of doing it and not in keeping with the current command framework, although the desc command will not show in the ddl group for help, it'll be a stealth shortcut.
        Hide
        Hari Sekhon added a comment -

        Here is another patch to add the desc command directly in the to the base Shell module itself. This does not require adding a desc.rb but it slightly hackish and out of tune with the shell framework.

        I'll leave it to your judgement to decide which is better.

        If you can find a better way I'd love to know it too.

        Thanks

        Hari

        Show
        Hari Sekhon added a comment - Here is another patch to add the desc command directly in the to the base Shell module itself. This does not require adding a desc.rb but it slightly hackish and out of tune with the shell framework. I'll leave it to your judgement to decide which is better. If you can find a better way I'd love to know it too. Thanks Hari
        Hide
        Hari Sekhon added a comment -

        Btw with this second patch the desc command won't appear in the help output so as not to confused those without much experience.

        Show
        Hari Sekhon added a comment - Btw with this second patch the desc command won't appear in the help output so as not to confused those without much experience.
        Hide
        stack added a comment -

        I like the v2 better. Nice trick. Should you add a note to the describe description allowing that 'desc' is enough? That you don't have to type out describe fully?

        Show
        stack added a comment - I like the v2 better. Nice trick. Should you add a note to the describe description allowing that 'desc' is enough? That you don't have to type out describe fully?
        Hide
        Andrew Purtell added a comment -

        Stale issue. Reopen if still relevant.

        Show
        Andrew Purtell added a comment - Stale issue. Reopen if still relevant.
        Hide
        Hari Sekhon added a comment -

        Would still like one of these 2 patches integrated to give the desc command in hbase shell.

        Anyone who's ever used a database knows 'desc', and it doesn't detract anything - people are still able to use the longer form 'describe'.

        Show
        Hari Sekhon added a comment - Would still like one of these 2 patches integrated to give the desc command in hbase shell. Anyone who's ever used a database knows 'desc', and it doesn't detract anything - people are still able to use the longer form 'describe'.
        Hide
        Sean Busbey added a comment -

        Hari Sekhon are you still working on this patch? If so, could you update it to incorporate the feedback from stack?

        Show
        Sean Busbey added a comment - Hari Sekhon are you still working on this patch? If so, could you update it to incorporate the feedback from stack?
        Hide
        Sean Busbey added a comment -

        Attaching alternate implementation that adds a general approach to aliasing commands (something we can reuse when maintaining deprecated command names).

        Show
        Sean Busbey added a comment - Attaching alternate implementation that adds a general approach to aliasing commands (something we can reuse when maintaining deprecated command names).
        Hide
        Sean Busbey added a comment -

        Leaves describing aliases to the original command, on the presumption that in some cases we won't want to call attention to them.

        Tested by spinning up single node, trying both 'describe' and 'desc' on a table I created.

        Ran through help, help 'ddl', help 'describe', and help 'desc'. Make sure "desc" didn't show up, save in the description of the "describe" command, but help 'desc' still worked.

        Show
        Sean Busbey added a comment - Leaves describing aliases to the original command, on the presumption that in some cases we won't want to call attention to them. Tested by spinning up single node, trying both 'describe' and 'desc' on a table I created. Ran through help, help 'ddl', help 'describe', and help 'desc'. Make sure "desc" didn't show up, save in the description of the "describe" command, but help 'desc' still worked.
        Hide
        Andrew Purtell added a comment - - edited

        +1, clean, nice
        Edit: Referring to v3 patch

        Show
        Andrew Purtell added a comment - - edited +1, clean, nice Edit: Referring to v3 patch
        Hide
        Nick Dimiduk added a comment -

        Hurray for aliasing! +1

        Show
        Nick Dimiduk added a comment - Hurray for aliasing! +1
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12663435/HBASE-8298-v3.patch
        against trunk revision .
        ATTACHMENT ID: 12663435

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

        -1 tests included. The patch doesn't appear to include any new or modified tests.
        Please justify why no new tests are needed for this patch.
        Also please list what manual steps were performed to verify this patch.

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

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

        -1 javadoc. The javadoc tool appears to have generated 7 warning messages.

        +1 findbugs. The patch does not introduce any new Findbugs (version 2.0.3) warnings.

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

        +1 lineLengths. The patch does not introduce lines longer than 100

        -1 site. The patch appears to cause mvn site goal to fail.

        -1 core tests. The patch failed these unit tests:

        -1 core zombie tests. There are 2 zombie test(s):

        Test results: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//testReport/
        Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//artifact/patchprocess/newPatchFindbugsWarningshbase-protocol.html
        Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//artifact/patchprocess/newPatchFindbugsWarningshbase-hadoop-compat.html
        Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//artifact/patchprocess/newPatchFindbugsWarningshbase-thrift.html
        Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//artifact/patchprocess/newPatchFindbugsWarningshbase-server.html
        Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//artifact/patchprocess/newPatchFindbugsWarningshbase-common.html
        Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//artifact/patchprocess/newPatchFindbugsWarningshbase-hadoop2-compat.html
        Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//artifact/patchprocess/newPatchFindbugsWarningshbase-examples.html
        Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//artifact/patchprocess/newPatchFindbugsWarningshbase-client.html
        Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//artifact/patchprocess/newPatchFindbugsWarningshbase-prefix-tree.html
        Console output: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//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/12663435/HBASE-8298-v3.patch against trunk revision . ATTACHMENT ID: 12663435 +1 @author . The patch does not contain any @author tags. -1 tests included . The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 javac . The applied patch does not increase the total number of javac compiler warnings. +1 javac . The applied patch does not increase the total number of javac compiler warnings. -1 javadoc . The javadoc tool appears to have generated 7 warning messages. +1 findbugs . The patch does not introduce any new Findbugs (version 2.0.3) warnings. +1 release audit . The applied patch does not increase the total number of release audit warnings. +1 lineLengths . The patch does not introduce lines longer than 100 -1 site . The patch appears to cause mvn site goal to fail. -1 core tests . The patch failed these unit tests: -1 core zombie tests . There are 2 zombie test(s): Test results: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//testReport/ Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//artifact/patchprocess/newPatchFindbugsWarningshbase-protocol.html Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//artifact/patchprocess/newPatchFindbugsWarningshbase-hadoop-compat.html Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//artifact/patchprocess/newPatchFindbugsWarningshbase-thrift.html Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//artifact/patchprocess/newPatchFindbugsWarningshbase-server.html Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//artifact/patchprocess/newPatchFindbugsWarningshbase-common.html Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//artifact/patchprocess/newPatchFindbugsWarningshbase-hadoop2-compat.html Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//artifact/patchprocess/newPatchFindbugsWarningshbase-examples.html Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//artifact/patchprocess/newPatchFindbugsWarningshbase-client.html Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//artifact/patchprocess/newPatchFindbugsWarningshbase-prefix-tree.html Console output: https://builds.apache.org/job/PreCommit-HBASE-Build/10522//console This message is automatically generated.
        Hide
        Sean Busbey added a comment -

        QA build failure looks like a jenkins issue unrelated to the patch.

        Show
        Sean Busbey added a comment - QA build failure looks like a jenkins issue unrelated to the patch.
        Hide
        Andrew Purtell added a comment -

        Committed to 0.98+

        Show
        Andrew Purtell added a comment - Committed to 0.98+
        Hide
        Hudson added a comment -

        FAILURE: Integrated in HBase-TRUNK #5424 (See https://builds.apache.org/job/HBase-TRUNK/5424/)
        HBASE-8298 In shell, provide alias of 'desc' for 'describe'. (apurtell: rev f69a1945c641c3eaba6a519e7a65eb54ce71f628)

        • hbase-shell/src/main/ruby/shell.rb
        • hbase-shell/src/main/ruby/shell/commands/describe.rb
        Show
        Hudson added a comment - FAILURE: Integrated in HBase-TRUNK #5424 (See https://builds.apache.org/job/HBase-TRUNK/5424/ ) HBASE-8298 In shell, provide alias of 'desc' for 'describe'. (apurtell: rev f69a1945c641c3eaba6a519e7a65eb54ce71f628) hbase-shell/src/main/ruby/shell.rb hbase-shell/src/main/ruby/shell/commands/describe.rb
        Hide
        Hudson added a comment -

        SUCCESS: Integrated in HBase-0.98 #467 (See https://builds.apache.org/job/HBase-0.98/467/)
        HBASE-8298 In shell, provide alias of 'desc' for 'describe'. (apurtell: rev 97468984216c4e2000493dbf4e33ebcf0f16c8e2)

        • hbase-shell/src/main/ruby/shell.rb
        • hbase-shell/src/main/ruby/shell/commands/describe.rb
        Show
        Hudson added a comment - SUCCESS: Integrated in HBase-0.98 #467 (See https://builds.apache.org/job/HBase-0.98/467/ ) HBASE-8298 In shell, provide alias of 'desc' for 'describe'. (apurtell: rev 97468984216c4e2000493dbf4e33ebcf0f16c8e2) hbase-shell/src/main/ruby/shell.rb hbase-shell/src/main/ruby/shell/commands/describe.rb
        Hide
        Hudson added a comment -

        FAILURE: Integrated in HBase-0.98-on-Hadoop-1.1 #440 (See https://builds.apache.org/job/HBase-0.98-on-Hadoop-1.1/440/)
        HBASE-8298 In shell, provide alias of 'desc' for 'describe'. (apurtell: rev 97468984216c4e2000493dbf4e33ebcf0f16c8e2)

        • hbase-shell/src/main/ruby/shell.rb
        • hbase-shell/src/main/ruby/shell/commands/describe.rb
        Show
        Hudson added a comment - FAILURE: Integrated in HBase-0.98-on-Hadoop-1.1 #440 (See https://builds.apache.org/job/HBase-0.98-on-Hadoop-1.1/440/ ) HBASE-8298 In shell, provide alias of 'desc' for 'describe'. (apurtell: rev 97468984216c4e2000493dbf4e33ebcf0f16c8e2) hbase-shell/src/main/ruby/shell.rb hbase-shell/src/main/ruby/shell/commands/describe.rb
        Hide
        Hudson added a comment -

        SUCCESS: Integrated in HBase-1.0 #120 (See https://builds.apache.org/job/HBase-1.0/120/)
        HBASE-8298 In shell, provide alias of 'desc' for 'describe'. (apurtell: rev 08c14bd5025977a606fbe9b3e7e256a9c83a4b91)

        • hbase-shell/src/main/ruby/shell/commands/describe.rb
        • hbase-shell/src/main/ruby/shell.rb
        Show
        Hudson added a comment - SUCCESS: Integrated in HBase-1.0 #120 (See https://builds.apache.org/job/HBase-1.0/120/ ) HBASE-8298 In shell, provide alias of 'desc' for 'describe'. (apurtell: rev 08c14bd5025977a606fbe9b3e7e256a9c83a4b91) hbase-shell/src/main/ruby/shell/commands/describe.rb hbase-shell/src/main/ruby/shell.rb
        Hide
        Enis Soztutar added a comment -

        Closing this issue after 0.99.0 release.

        Show
        Enis Soztutar added a comment - Closing this issue after 0.99.0 release.

          People

          • Assignee:
            Sean Busbey
            Reporter:
            Hari Sekhon
          • Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development