HBase
  1. HBase
  2. HBASE-8298

desc <tablename> shorthand for describe <tablename>, similar to how databases have

    Details

    • Type: Improvement Improvement
    • Status: Reopened
    • Priority: Trivial Trivial
    • Resolution: Unresolved
    • Affects Version/s: 0.94.2
    • Fix Version/s: None
    • Component/s: shell
    • Labels:
      None

      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

        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'.

          People

          • Assignee:
            Unassigned
            Reporter:
            Hari Sekhon
          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:

              Development