[
https://issues.apache.org/jira/browse/PIG-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12776767#action_12776767
]
Pradeep Kamath commented on PIG-742:
------------------------------------
I gave a shot at changing introducing a new production in QueryParser.jjt but
it didnt work. I am wondering if this issue is really because javacc's
tokenizer needs a whitespace to tokenize - anybody with more experience with
javacc want to comment?
Here's the patch of what I tried:
{code}
Index: src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt
===================================================================
--- src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt (revision
834628)
+++ src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt (working copy)
@@ -979,7 +979,8 @@
| <#DIGIT : ["0"-"9"] >
| <#SPECIALCHAR : ["_"] >
| <#FSSPECIALCHAR: ["-", ":", "/"]>
-| <IDENTIFIER: ( <LETTER> )+ ( <DIGIT> | <LETTER> | <SPECIALCHAR> |
"::")* >
+| <IDENTIFIER: ( <LETTER> )+ ( <DIGIT> | <LETTER> | <SPECIALCHAR> | "::"
)* >
+| <IDENTIFIEREQUAL: ( <LETTER> )+ ( <DIGIT> | <LETTER> | <SPECIALCHAR> |
"::" )* ("=") >
}
// Define Numeric Constants
TOKEN :
@@ -1010,12 +1011,15 @@
// Pig has special variables starting with $
TOKEN : { <DOLLARVAR : "$" <INTEGER> > }
+TOKEN : { <EQUAL: "="> }
+
// Parse is the Starting function.
LogicalPlan Parse() :
{
LogicalOperator root = null;
Token t1;
Token t2;
+ String alias;
LogicalPlan lp = new LogicalPlan();
log.trace("Entering Parse");
}
@@ -1028,7 +1032,8 @@
throw new ParseException(
"Currently PIG does not support assigning an existing
relation (" + t1.image + ") to another alias (" + t2.image + ")");})
| LOOKAHEAD(2)
- (t1 = <IDENTIFIER> "=" root = Expr(lp) ";" {
+ (
+ (t1 = <IDENTIFIER> <EQUAL> { alias = t1.image;}| t1 =
<IDENTIFIEREQUAL> { alias = t1.image.replaceAll("=", ""); }) root = Expr(lp)
";" {
root.setAlias(t1.image);
addAlias(t1.image, root);
pigContext.setLastAlias(t1.image);
{code}
> Spaces could be optional in Pig syntax
> --------------------------------------
>
> Key: PIG-742
> URL: https://issues.apache.org/jira/browse/PIG-742
> Project: Pig
> Issue Type: Wish
> Components: grunt
> Affects Versions: 0.3.0
> Reporter: Viraj Bhat
> Priority: Minor
>
> The following Pig statements generate an error if there is no space between A
> and "="
> {code}
> A=load 'quf.txt' using PigStorage() as (q, u, f:long);
> B = group A by (q);
> C = foreach B {
> F = order A by f desc;
> generate F;
> };
> describe C;
> dump C;
> {code}
> 2009-03-31 17:14:15,959 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR
> 1000: Error during parsing. Encountered
> " <PATH> "A=load "" at line 1, column 1.
> Was expecting one of:
> <EOF>
> "cat" ...
> "cd" ...
> "cp" ...
> "copyFromLocal" ...
> "copyToLocal" ...
> "dump" ...
> "describe" ...
> "aliases" ...
> "explain" ...
> "help" ...
> "kill" ...
> "ls" ...
> "mv" ...
> "mkdir" ...
> "pwd" ...
> "quit" ...
> "register" ...
> "rm" ...
> "rmf" ...
> "set" ...
> "illustrate" ...
> "run" ...
> "exec" ...
> "scriptDone" ...
> "" ...
> <EOL> ...
> ";" ...
> It would be nice if the parser would not expect these space requirements
> between an alias and "="
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.