You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Vivek Padmanabhan (JIRA)" <ji...@apache.org> on 2011/07/21 13:16:58 UTC

[jira] [Created] (PIG-2184) Not able to provide positional reference to macro invocations

Not able to provide positional reference to macro invocations
-------------------------------------------------------------

                 Key: PIG-2184
                 URL: https://issues.apache.org/jira/browse/PIG-2184
             Project: Pig
          Issue Type: Bug
    Affects Versions: 0.9.0
            Reporter: Vivek Padmanabhan


It looks like the macro functionality doesnt support for positional references. The below is an example script;

----------------------------------------------------------------------------
DEFINE my_macro (X,key) returns Y
        {
        tmp1 = foreach  $X generate TOKENIZE((chararray)$key) as tokens;
        tmp2 = foreach tmp1 generate flatten(tokens);
        tmp3 = order tmp2 by $0;
        $Y = distinct tmp3;
        }

A = load 'sometext' using TextLoader() as (row1) ;
E = my_macro(A,A.$0);
dump E;
----------------------------------------------------------------------------

This script execution fails at parsing staging itself;

org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. <file try1.pig, line 16,
column 16>  mismatched input '.' expecting RIGHT_PAREN

If i replace A.$0 with the field name ie row1 the script runs fine.

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

        

[jira] [Commented] (PIG-2184) Not able to provide positional reference to macro invocations

Posted by "Daniel Dai (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13148213#comment-13148213 ] 

Daniel Dai commented on PIG-2184:
---------------------------------

Hi, Alan,
Here we need to replace 'key' to "$0". Parameter substitution does not allow "$0" to be the value, but seems it takes "\\$0". This works but I am not if there's a better fix.
                
> Not able to provide positional reference to macro invocations
> -------------------------------------------------------------
>
>                 Key: PIG-2184
>                 URL: https://issues.apache.org/jira/browse/PIG-2184
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.0
>            Reporter: Vivek Padmanabhan
>            Assignee: xuting zhao
>             Fix For: 0.10
>
>
> It looks like the macro functionality doesnt support for positional references. The below is an example script;
> ----------------------------------------------------------------------------
> DEFINE my_macro (X,key) returns Y
>         {
>         tmp1 = foreach  $X generate TOKENIZE((chararray)$key) as tokens;
>         tmp2 = foreach tmp1 generate flatten(tokens);
>         tmp3 = order tmp2 by $0;
>         $Y = distinct tmp3;
>         }
> A = load 'sometext' using TextLoader() as (row1) ;
> E = my_macro(A,A.$0);
> dump E;
> ----------------------------------------------------------------------------
> This script execution fails at parsing staging itself;
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. <file try1.pig, line 16,
> column 16>  mismatched input '.' expecting RIGHT_PAREN
> If i replace A.$0 with the field name ie row1 the script runs fine.

--
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

        

[jira] [Commented] (PIG-2184) Not able to provide positional reference to macro invocations

Posted by "xuting zhao (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13147926#comment-13147926 ] 

xuting zhao commented on PIG-2184:
----------------------------------

Hi Daniel,

   Thanks for the comments. I guess this also explains the error I got after modifing the parser and passing the A.$0 as parameter into the macrio function. One thing I am not sure is if we allow parameter $0, then how can we know which dataset $0 stands for? For example, if my_macro only contains one parameter and user called my_macro($0)?

Best,
Xuting
                
> Not able to provide positional reference to macro invocations
> -------------------------------------------------------------
>
>                 Key: PIG-2184
>                 URL: https://issues.apache.org/jira/browse/PIG-2184
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.0
>            Reporter: Vivek Padmanabhan
>            Assignee: xuting zhao
>             Fix For: 0.10
>
>
> It looks like the macro functionality doesnt support for positional references. The below is an example script;
> ----------------------------------------------------------------------------
> DEFINE my_macro (X,key) returns Y
>         {
>         tmp1 = foreach  $X generate TOKENIZE((chararray)$key) as tokens;
>         tmp2 = foreach tmp1 generate flatten(tokens);
>         tmp3 = order tmp2 by $0;
>         $Y = distinct tmp3;
>         }
> A = load 'sometext' using TextLoader() as (row1) ;
> E = my_macro(A,A.$0);
> dump E;
> ----------------------------------------------------------------------------
> This script execution fails at parsing staging itself;
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. <file try1.pig, line 16,
> column 16>  mismatched input '.' expecting RIGHT_PAREN
> If i replace A.$0 with the field name ie row1 the script runs fine.

--
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

        

[jira] [Commented] (PIG-2184) Not able to provide positional reference to macro invocations

Posted by "Daniel Dai (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13149814#comment-13149814 ] 

Daniel Dai commented on PIG-2184:
---------------------------------

As per Pig Macro doc, Pig macros support four types of parameters:
* alias (IDENTIFIER)
* integer
* float
* string literal (quoted string)

We shall add one more:
* field (IDENTIFIER or position in the form $int)

Which the new definition, we will not allow "A.$0", since this is a mix of alias and field.
                
> Not able to provide positional reference to macro invocations
> -------------------------------------------------------------
>
>                 Key: PIG-2184
>                 URL: https://issues.apache.org/jira/browse/PIG-2184
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.0
>            Reporter: Vivek Padmanabhan
>            Assignee: xuting zhao
>             Fix For: 0.10
>
>
> It looks like the macro functionality doesnt support for positional references. The below is an example script;
> ----------------------------------------------------------------------------
> DEFINE my_macro (X,key) returns Y
>         {
>         tmp1 = foreach  $X generate TOKENIZE((chararray)$key) as tokens;
>         tmp2 = foreach tmp1 generate flatten(tokens);
>         tmp3 = order tmp2 by $0;
>         $Y = distinct tmp3;
>         }
> A = load 'sometext' using TextLoader() as (row1) ;
> E = my_macro(A,A.$0);
> dump E;
> ----------------------------------------------------------------------------
> This script execution fails at parsing staging itself;
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. <file try1.pig, line 16,
> column 16>  mismatched input '.' expecting RIGHT_PAREN
> If i replace A.$0 with the field name ie row1 the script runs fine.

--
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

        

[jira] [Updated] (PIG-2184) Not able to provide positional reference to macro invocations

Posted by "Daniel Dai (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-2184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Dai updated PIG-2184:
----------------------------

      Resolution: Fixed
    Hadoop Flags: Reviewed
          Status: Resolved  (was: Patch Available)

Unit test pass. test-patch:

     [exec] -1 overall.  
     [exec] 
     [exec]     +1 @author.  The patch does not contain any @author tags.
     [exec] 
     [exec]     +1 tests included.  The patch appears to include 3 new or modified tests.
     [exec] 
     [exec]     +1 javadoc.  The javadoc tool did not generate any warning messages.
     [exec] 
     [exec]     -1 javac.  The applied patch generated 964 javac compiler warnings (more than the trunk's current 962 warnings).
     [exec] 
     [exec]     +1 findbugs.  The patch does not introduce any new Findbugs warnings.
     [exec] 
     [exec]     -1 release audit.  The applied patch generated 475 release audit warnings (more than the trunk's current 468 warnings).

javac warning is in generated file. No new file added so ignore release audit warning.

Patch committed to trunk and 0.10 branch.

Thanks Xuting!
                
> Not able to provide positional reference to macro invocations
> -------------------------------------------------------------
>
>                 Key: PIG-2184
>                 URL: https://issues.apache.org/jira/browse/PIG-2184
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.0
>            Reporter: Vivek Padmanabhan
>            Assignee: xuting zhao
>             Fix For: 0.10
>
>         Attachments: 2184.patch
>
>
> It looks like the macro functionality doesnt support for positional references. The below is an example script;
> ----------------------------------------------------------------------------
> DEFINE my_macro (X,key) returns Y
>         {
>         tmp1 = foreach  $X generate TOKENIZE((chararray)$key) as tokens;
>         tmp2 = foreach tmp1 generate flatten(tokens);
>         tmp3 = order tmp2 by $0;
>         $Y = distinct tmp3;
>         }
> A = load 'sometext' using TextLoader() as (row1) ;
> E = my_macro(A,A.$0);
> dump E;
> ----------------------------------------------------------------------------
> This script execution fails at parsing staging itself;
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. <file try1.pig, line 16,
> column 16>  mismatched input '.' expecting RIGHT_PAREN
> If i replace A.$0 with the field name ie row1 the script runs fine.

--
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

        

[jira] [Commented] (PIG-2184) Not able to provide positional reference to macro invocations

Posted by "Daniel Dai (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13150682#comment-13150682 ] 

Daniel Dai commented on PIG-2184:
---------------------------------

Sounds good. Running the tests.
                
> Not able to provide positional reference to macro invocations
> -------------------------------------------------------------
>
>                 Key: PIG-2184
>                 URL: https://issues.apache.org/jira/browse/PIG-2184
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.0
>            Reporter: Vivek Padmanabhan
>            Assignee: xuting zhao
>             Fix For: 0.10
>
>         Attachments: 2184.patch
>
>
> It looks like the macro functionality doesnt support for positional references. The below is an example script;
> ----------------------------------------------------------------------------
> DEFINE my_macro (X,key) returns Y
>         {
>         tmp1 = foreach  $X generate TOKENIZE((chararray)$key) as tokens;
>         tmp2 = foreach tmp1 generate flatten(tokens);
>         tmp3 = order tmp2 by $0;
>         $Y = distinct tmp3;
>         }
> A = load 'sometext' using TextLoader() as (row1) ;
> E = my_macro(A,A.$0);
> dump E;
> ----------------------------------------------------------------------------
> This script execution fails at parsing staging itself;
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. <file try1.pig, line 16,
> column 16>  mismatched input '.' expecting RIGHT_PAREN
> If i replace A.$0 with the field name ie row1 the script runs fine.

--
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

        

[jira] [Commented] (PIG-2184) Not able to provide positional reference to macro invocations

Posted by "xuting zhao (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13150153#comment-13150153 ] 

xuting zhao commented on PIG-2184:
----------------------------------

 I use the method which adds "\\" in front of the dollar variable. If we call the Matcher.quoteReplacement(val) function in PreprocessorContext.java, it will be too general and as a result, there will be some problem in parameter substitution. For example, '\' will be added in front of URL parameters.

 
 Ant test-commit has been run successfully and a new Junit test has been added into the test/org/apache/pig/test/TestMacroExpansion.java. The old Junit test of PIG-2081 has been removed because it is about adding error message under this situation 
                
> Not able to provide positional reference to macro invocations
> -------------------------------------------------------------
>
>                 Key: PIG-2184
>                 URL: https://issues.apache.org/jira/browse/PIG-2184
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.0
>            Reporter: Vivek Padmanabhan
>            Assignee: xuting zhao
>             Fix For: 0.10
>
>         Attachments: 2184.patch
>
>
> It looks like the macro functionality doesnt support for positional references. The below is an example script;
> ----------------------------------------------------------------------------
> DEFINE my_macro (X,key) returns Y
>         {
>         tmp1 = foreach  $X generate TOKENIZE((chararray)$key) as tokens;
>         tmp2 = foreach tmp1 generate flatten(tokens);
>         tmp3 = order tmp2 by $0;
>         $Y = distinct tmp3;
>         }
> A = load 'sometext' using TextLoader() as (row1) ;
> E = my_macro(A,A.$0);
> dump E;
> ----------------------------------------------------------------------------
> This script execution fails at parsing staging itself;
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. <file try1.pig, line 16,
> column 16>  mismatched input '.' expecting RIGHT_PAREN
> If i replace A.$0 with the field name ie row1 the script runs fine.

--
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

        

[jira] [Updated] (PIG-2184) Not able to provide positional reference to macro invocations

Posted by "xuting zhao (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-2184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

xuting zhao updated PIG-2184:
-----------------------------

    Attachment: 2184.patch
    
> Not able to provide positional reference to macro invocations
> -------------------------------------------------------------
>
>                 Key: PIG-2184
>                 URL: https://issues.apache.org/jira/browse/PIG-2184
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.0
>            Reporter: Vivek Padmanabhan
>            Assignee: xuting zhao
>             Fix For: 0.10
>
>         Attachments: 2184.patch
>
>
> It looks like the macro functionality doesnt support for positional references. The below is an example script;
> ----------------------------------------------------------------------------
> DEFINE my_macro (X,key) returns Y
>         {
>         tmp1 = foreach  $X generate TOKENIZE((chararray)$key) as tokens;
>         tmp2 = foreach tmp1 generate flatten(tokens);
>         tmp3 = order tmp2 by $0;
>         $Y = distinct tmp3;
>         }
> A = load 'sometext' using TextLoader() as (row1) ;
> E = my_macro(A,A.$0);
> dump E;
> ----------------------------------------------------------------------------
> This script execution fails at parsing staging itself;
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. <file try1.pig, line 16,
> column 16>  mismatched input '.' expecting RIGHT_PAREN
> If i replace A.$0 with the field name ie row1 the script runs fine.

--
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

        

[jira] [Updated] (PIG-2184) Not able to provide positional reference to macro invocations

Posted by "Olga Natkovich (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-2184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Olga Natkovich updated PIG-2184:
--------------------------------

    Fix Version/s:     (was: 0.10)
    
> Not able to provide positional reference to macro invocations
> -------------------------------------------------------------
>
>                 Key: PIG-2184
>                 URL: https://issues.apache.org/jira/browse/PIG-2184
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.0
>            Reporter: Vivek Padmanabhan
>
> It looks like the macro functionality doesnt support for positional references. The below is an example script;
> ----------------------------------------------------------------------------
> DEFINE my_macro (X,key) returns Y
>         {
>         tmp1 = foreach  $X generate TOKENIZE((chararray)$key) as tokens;
>         tmp2 = foreach tmp1 generate flatten(tokens);
>         tmp3 = order tmp2 by $0;
>         $Y = distinct tmp3;
>         }
> A = load 'sometext' using TextLoader() as (row1) ;
> E = my_macro(A,A.$0);
> dump E;
> ----------------------------------------------------------------------------
> This script execution fails at parsing staging itself;
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. <file try1.pig, line 16,
> column 16>  mismatched input '.' expecting RIGHT_PAREN
> If i replace A.$0 with the field name ie row1 the script runs fine.

--
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

        

[jira] [Commented] (PIG-2184) Not able to provide positional reference to macro invocations

Posted by "Alan Gates (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13148210#comment-13148210 ] 

Alan Gates commented on PIG-2184:
---------------------------------

bq. in param substitution, $0 is not a valid value, we need to fix
How do we need to fix this?  $0 shouldn't be a valid parameter substitution.
                
> Not able to provide positional reference to macro invocations
> -------------------------------------------------------------
>
>                 Key: PIG-2184
>                 URL: https://issues.apache.org/jira/browse/PIG-2184
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.0
>            Reporter: Vivek Padmanabhan
>            Assignee: xuting zhao
>             Fix For: 0.10
>
>
> It looks like the macro functionality doesnt support for positional references. The below is an example script;
> ----------------------------------------------------------------------------
> DEFINE my_macro (X,key) returns Y
>         {
>         tmp1 = foreach  $X generate TOKENIZE((chararray)$key) as tokens;
>         tmp2 = foreach tmp1 generate flatten(tokens);
>         tmp3 = order tmp2 by $0;
>         $Y = distinct tmp3;
>         }
> A = load 'sometext' using TextLoader() as (row1) ;
> E = my_macro(A,A.$0);
> dump E;
> ----------------------------------------------------------------------------
> This script execution fails at parsing staging itself;
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. <file try1.pig, line 16,
> column 16>  mismatched input '.' expecting RIGHT_PAREN
> If i replace A.$0 with the field name ie row1 the script runs fine.

--
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

        

[jira] [Updated] (PIG-2184) Not able to provide positional reference to macro invocations

Posted by "xuting zhao (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-2184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

xuting zhao updated PIG-2184:
-----------------------------

    Status: Patch Available  (was: Open)
    
> Not able to provide positional reference to macro invocations
> -------------------------------------------------------------
>
>                 Key: PIG-2184
>                 URL: https://issues.apache.org/jira/browse/PIG-2184
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.0
>            Reporter: Vivek Padmanabhan
>            Assignee: xuting zhao
>             Fix For: 0.10
>
>         Attachments: 2184.patch
>
>
> It looks like the macro functionality doesnt support for positional references. The below is an example script;
> ----------------------------------------------------------------------------
> DEFINE my_macro (X,key) returns Y
>         {
>         tmp1 = foreach  $X generate TOKENIZE((chararray)$key) as tokens;
>         tmp2 = foreach tmp1 generate flatten(tokens);
>         tmp3 = order tmp2 by $0;
>         $Y = distinct tmp3;
>         }
> A = load 'sometext' using TextLoader() as (row1) ;
> E = my_macro(A,A.$0);
> dump E;
> ----------------------------------------------------------------------------
> This script execution fails at parsing staging itself;
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. <file try1.pig, line 16,
> column 16>  mismatched input '.' expecting RIGHT_PAREN
> If i replace A.$0 with the field name ie row1 the script runs fine.

--
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

        

[jira] [Updated] (PIG-2184) Not able to provide positional reference to macro invocations

Posted by "Olga Natkovich (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-2184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Olga Natkovich updated PIG-2184:
--------------------------------

    Fix Version/s: 0.10

> Not able to provide positional reference to macro invocations
> -------------------------------------------------------------
>
>                 Key: PIG-2184
>                 URL: https://issues.apache.org/jira/browse/PIG-2184
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.0
>            Reporter: Vivek Padmanabhan
>             Fix For: 0.10
>
>
> It looks like the macro functionality doesnt support for positional references. The below is an example script;
> ----------------------------------------------------------------------------
> DEFINE my_macro (X,key) returns Y
>         {
>         tmp1 = foreach  $X generate TOKENIZE((chararray)$key) as tokens;
>         tmp2 = foreach tmp1 generate flatten(tokens);
>         tmp3 = order tmp2 by $0;
>         $Y = distinct tmp3;
>         }
> A = load 'sometext' using TextLoader() as (row1) ;
> E = my_macro(A,A.$0);
> dump E;
> ----------------------------------------------------------------------------
> This script execution fails at parsing staging itself;
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. <file try1.pig, line 16,
> column 16>  mismatched input '.' expecting RIGHT_PAREN
> If i replace A.$0 with the field name ie row1 the script runs fine.

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

        

[jira] [Updated] (PIG-2184) Not able to provide positional reference to macro invocations

Posted by "Olga Natkovich (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-2184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Olga Natkovich updated PIG-2184:
--------------------------------

    Fix Version/s: 0.10
         Assignee: xuting zhao

Hi Xuting, Could you take a look at this when you get a chance.
                
> Not able to provide positional reference to macro invocations
> -------------------------------------------------------------
>
>                 Key: PIG-2184
>                 URL: https://issues.apache.org/jira/browse/PIG-2184
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.0
>            Reporter: Vivek Padmanabhan
>            Assignee: xuting zhao
>             Fix For: 0.10
>
>
> It looks like the macro functionality doesnt support for positional references. The below is an example script;
> ----------------------------------------------------------------------------
> DEFINE my_macro (X,key) returns Y
>         {
>         tmp1 = foreach  $X generate TOKENIZE((chararray)$key) as tokens;
>         tmp2 = foreach tmp1 generate flatten(tokens);
>         tmp3 = order tmp2 by $0;
>         $Y = distinct tmp3;
>         }
> A = load 'sometext' using TextLoader() as (row1) ;
> E = my_macro(A,A.$0);
> dump E;
> ----------------------------------------------------------------------------
> This script execution fails at parsing staging itself;
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. <file try1.pig, line 16,
> column 16>  mismatched input '.' expecting RIGHT_PAREN
> If i replace A.$0 with the field name ie row1 the script runs fine.

--
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

        

[jira] [Commented] (PIG-2184) Not able to provide positional reference to macro invocations

Posted by "Daniel Dai (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13147896#comment-13147896 ] 

Daniel Dai commented on PIG-2184:
---------------------------------

The script seems not right. Macro only do literal substitution, so with
E = my_macro(A,A.$0);

We will get "tmp1 = foreach $X generate TOKENIZE((chararray)A.$0) as tokens;", which is wrong.

However, "E = my_macro(A,$0);" also does not work. We should fix this case. There are two issues:
1. in parser, my_macro(A, $0) is not allowed, we need to allow this
2. in param substitution, $0 is not a valid value, we need to fix
                
> Not able to provide positional reference to macro invocations
> -------------------------------------------------------------
>
>                 Key: PIG-2184
>                 URL: https://issues.apache.org/jira/browse/PIG-2184
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.0
>            Reporter: Vivek Padmanabhan
>            Assignee: xuting zhao
>             Fix For: 0.10
>
>
> It looks like the macro functionality doesnt support for positional references. The below is an example script;
> ----------------------------------------------------------------------------
> DEFINE my_macro (X,key) returns Y
>         {
>         tmp1 = foreach  $X generate TOKENIZE((chararray)$key) as tokens;
>         tmp2 = foreach tmp1 generate flatten(tokens);
>         tmp3 = order tmp2 by $0;
>         $Y = distinct tmp3;
>         }
> A = load 'sometext' using TextLoader() as (row1) ;
> E = my_macro(A,A.$0);
> dump E;
> ----------------------------------------------------------------------------
> This script execution fails at parsing staging itself;
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. <file try1.pig, line 16,
> column 16>  mismatched input '.' expecting RIGHT_PAREN
> If i replace A.$0 with the field name ie row1 the script runs fine.

--
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