You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Doug Daniels (Created) (JIRA)" <ji...@apache.org> on 2012/03/26 22:34:30 UTC

[jira] [Created] (PIG-2617) Project-Range expression fails inside macro for UDF arguments

Project-Range expression fails inside macro for UDF arguments 
--------------------------------------------------------------

                 Key: PIG-2617
                 URL: https://issues.apache.org/jira/browse/PIG-2617
             Project: Pig
          Issue Type: Bug
          Components: parser
    Affects Versions: 0.9.2, 0.10
            Reporter: Doug Daniels


The Project-Range feature (fieldA..fieldB) fails inside a macro for UDF arguments, but works outside of a macro.

For example, this script works:

{code}
input_data = LOAD 'input_strings.txt' USING PigStorage('\t') AS (x:chararray, y:chararray);
output_data = FOREACH input_data GENERATE CONCAT(x..y);
{code}

but this script fails:

{code}
define my_macro(incoming) returns outgoing {
    $outgoing = FOREACH $incoming GENERATE CONCAT(x..y);
}

input_data = LOAD 'input_strings.txt' USING PigStorage('\t') AS (x:chararray, y:chararray);
output_data = my_macro(input_data);
{code}

with stack trace:

Pig Stack Trace
---------------
ERROR 1200: <line 6> Failed to mask macro 'my_macro'. Reason: /home/hortonji/pig9/src//org/apache/pig/parser/AliasMasker.g: node from after line 2:46 mismatched tree node: COL_RANGE expecting <UP>
macro content: 
    output_data = FOREACH input_data GENERATE CONCAT(x..y);

org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. <line 6> Failed to mask macro 'my_macro'. Reason: /home/hortonji/pig9/src//org/apache/pig/parser/AliasMasker.g: node from after line 2:46 mismatched tree node: COL_RANGE expecting <UP>
macro content: 
    output_data = FOREACH input_data GENERATE CONCAT(x..y);

        at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1641)
        at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1584)
        at org.apache.pig.PigServer.registerQuery(PigServer.java:584)
        at org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:942)
        at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:386)
        at org.apache.pig.tools.grunt.GruntParser.loadScript(GruntParser.java:516)
        at org.apache.pig.tools.grunt.GruntParser.processExplain(GruntParser.java:314)
        at org.apache.pig.tools.grunt.GruntParser.processExplain(GruntParser.java:288)
        at org.apache.pig.tools.pigscript.parser.PigScriptParser.Explain(PigScriptParser.java:665)
        at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:325)
        at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:188)
        at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:164)
        at org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:84)
        at org.apache.pig.Main.run(Main.java:464)
        at org.apache.pig.Main.main(Main.java:111)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:192)
Caused by: Failed to parse: <line 6> Failed to mask macro 'my_macro'. Reason: /home/hortonji/pig9/src//org/apache/pig/parser/AliasMasker.g: node from after line 2:46 mismatched tree node: COL_RANGE expecting <UP>
macro content: 
    output_data = FOREACH input_data GENERATE CONCAT(x..y);

        at org.apache.pig.parser.PigMacro.maskAlias(PigMacro.java:254)
        at org.apache.pig.parser.PigMacro.inline(PigMacro.java:101)
        at org.apache.pig.parser.PigMacro.macroInline(PigMacro.java:456)
        at org.apache.pig.parser.QueryParserDriver.inlineMacro(QueryParserDriver.java:279)
        at org.apache.pig.parser.QueryParserDriver.expandMacro(QueryParserDriver.java:268)
        at org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:165)
        at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1633)
        ... 19 more
================================================================================

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira