[
https://issues.apache.org/jira/browse/PIG-2994?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13566790#comment-13566790
]
Cheolsoo Park commented on PIG-2994:
------------------------------------
[~prasanth_j] Thank you very much for the patch! This is very convenient. I
have two suggestions.
* Can we simplify the grammar?
From:
{code}
<DUMP>
(
t1 = <IDENTIFIER>
{processDump(t1.image);}
|
{processDump(null);}
)
|
<DUMP_SHORT>
(
t1 = <IDENTIFIER>
{processDump(t1.image);}
|
{processDump(null);}
)
{code}
To:
{code}
( <DUMP> | <DUMP_SHORT> )
(
t1 = <IDENTIFIER>
{processDump(t1.image);}
|
{processDump(null);}
)
{code}
The same goes to all the shortcuts that you're adding. I tested it myself, and
it seems to work. Please correct me if I am wrong because I am no expert on
JAVACC.
* Can we throw an exception if dump/explain/illustrate is called with no alias
&& there is no previous alias in the Pig context?
For example, if I have a dummy script such as follows:
{code}
DUMP;
{code}
Since dump, explain, and illustrate are now allowed with no alias, my script
fails with the following error at logical plan validation:
{code}
org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1066: Unable to open
iterator for alias null
{code}
However, it used to fail faster at parsing:
{code}
ERROR 1000: Error during parsing. Encountered " <IDENTIFIER> "d "" at line 2,
column 1.
{code}
I think the original error is more intuitive. We can probably add a null check
after getLastAlias(). For example,
{code}
alias = mPigServer.getPigContext().getLastAlias();
if (alias == null) {
throw new ParseException("'illustrate' statement must be on an alias or on
a script.");
}
{code}
Please let me know what you think. Thanks!
> 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