You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Jakob Homan (JIRA)" <ji...@apache.org> on 2011/08/09 23:16:27 UTC

[jira] [Updated] (HIVE-2233) Show current database in hive prompt

     [ https://issues.apache.org/jira/browse/HIVE-2233?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jakob Homan updated HIVE-2233:
------------------------------

    Attachment: HIVE-2233.patch

Patch for review.
* Add new option {{hive.cli.print.current.db}} that, if enabled, will show the currently selected database in the prompt like so:
{noformat}Hive history file=/tmp/jhoman/hive_job_log_jhoman_201108091406_1596091783.txt                                                            
hive (default)> show                                                                                                                     
              > tables;                                                                                                                  
OK                                                                                                                                       
Time taken: 3.07 seconds                                                                                                                 
hive (default)> use abcdefghijklmnopqrstuvwxyz;                                                                                          
OK                                                                                                                                       
Time taken: 0.013 seconds                                                                                                                
hive (abcdefghijklmnopqrstuvwxyz)> show                                                                                                  
                                 > tables;                                                                                               
OK                                                                                                                                       
Time taken: 0.095 seconds                                                                                                                
hive (abcdefghijklmnopqrstuvwxyz)> set hive.cli.print.current.db=false;                                                                  
hive>{noformat}

The current database is obtained by creating a Hive instance within the CliSessionState.  This appears to be a reasonable solution, though an alternative would be to add a get_current_db call to the Thrift interface and go through the already existing HiveClient in the CliSessionState.  

Since this only affects interactive clients, TestCliDriver tests aren't applicable.  It's been tested manually (as above), and I'd be happy to write some unit tests, but I've already got two patches that add Mockito waiting to be committed (HIVE-2334 and HIVE-2171), so there's not much point in adding it again.   

> Show current database in hive prompt
> ------------------------------------
>
>                 Key: HIVE-2233
>                 URL: https://issues.apache.org/jira/browse/HIVE-2233
>             Project: Hive
>          Issue Type: Improvement
>    Affects Versions: 0.7.0
>            Reporter: Jakob Homan
>            Assignee: Jakob Homan
>             Fix For: 0.8.0
>
>         Attachments: HIVE-2233.patch
>
>
> Currently the hive prompt doesn't show which database the user in.  It would be nice if it were something along the lines of {noformat}hive (prod_tracking)>{noformat} or such.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira