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

Prasanth J commented on PIG-2994:
---------------------------------

Great suggestions Cheolsoo! Thanks for your review. 

Regarding your 2nd suggestion, one thing I noticed from the grunt parser code 
is that only ILLUSTRATE and EXPLAIN operator supports "-script" option wherein 
we can pass a pig script as an argument. Hence these commands are valid even 
when last alias is not defined yet. 
For example: 
{code}grunt> \i -script /illustrate.pig{code}
is a valid operation even when there is no previously defined alias. Similarly 
for explain.

Hence just checking 'alias == null' after will make the above operation 
invalid. So my suggestion is to do the following
{code}alias = mPigServer.getPigContext().getLastAlias();
if (alias == null && script == null) {
    throw new ParseException("'illustrate' statement must be on an alias or on 
a script.");
}{code}

Please let me know if this looks good. I will resubmit the patch incorporating 
the changes you had mentioned along with documentation.
                
> Grunt shortcuts
> ---------------
>
>                 Key: PIG-2994
>                 URL: https://issues.apache.org/jira/browse/PIG-2994
>             Project: Pig
>          Issue Type: New Feature
>          Components: grunt
>            Reporter: Prasanth J
>            Assignee: Prasanth J
>            Priority: Minor
>         Attachments: PIG-2994.1.git.patch
>
>
> This feature is aimed at providing shortcuts for frequently used commands 
> like illustrate, dump, explain, describe, quit, help etc. This feature is 
> inspired from postgres(psql) shortcuts. I tried implementing a simple 
> shortcut for quitting the grunt shell using \q with very minimal changes. I 
> think this feature will help save many keystrokes for users. If this feature 
> looks useful I can submit the current patch for review and go ahead with 
> implementing the following shortcuts
> \i <alias> - illustrate
> \e <alias> - explain
> \de <alias> - describe
> \du <alias> - dump 
> \h - help
> This will also be useful to view information about tables/statistics stored 
> in HCatalog similar to the way psql does. 
> \dt <alias> - display table
> \dm - display metadata
> etc..
> except \t, \r and \n delimiters we should be able to use all other characters 
> as shortcuts. 
> Please let me know your thoughts.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to