[jira] [Updated] (PIG-3114) Duplicated macro name error when using pigunit

2015-02-24 Thread Jerome Serrano (JIRA)

 [ 
https://issues.apache.org/jira/browse/PIG-3114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jerome Serrano updated PIG-3114:

Attachment: bug_pig.tbz2

Maven project to reproduce the issue. "mvn test" to run the test.

> Duplicated macro name error when using pigunit
> --
>
> Key: PIG-3114
> URL: https://issues.apache.org/jira/browse/PIG-3114
> Project: Pig
>  Issue Type: Bug
>  Components: parser
>Affects Versions: 0.11
>Reporter: Chetan Nadgire
>Assignee: Daniel Dai
> Fix For: 0.12.0
>
> Attachments: PIG-3114-2.patch, PIG-3114-3.patch, PIG-3114.patch, 
> PIG-3114.patch, PatchedPigTest.java, bug_pig.tbz2
>
>
> I'm using PigUnit to test a pig script within which a macro is defined.
> Pig runs fine on cluster but getting parsing error with pigunit.
> So I tried very basic pig script with macro and getting similar error.
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during 
> parsing.  null. Reason: Duplicated macro name 'my_macro_1'
>   at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1607)
>   at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1546)
>   at org.apache.pig.PigServer.registerQuery(PigServer.java:516)
>   at 
> org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:988)
>   at 
> org.apache.pig.pigunit.pig.GruntParser.processPig(GruntParser.java:61)
>   at 
> org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:412)
>   at 
> org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:194)
>   at 
> org.apache.pig.pigunit.pig.PigServer.registerScript(PigServer.java:56)
>   at org.apache.pig.pigunit.PigTest.registerScript(PigTest.java:160)
>   at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:231)
>   at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:261)
>   at FirstPigTest.MyPigTest.testTop2Queries(MyPigTest.java:32)
>   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 junit.framework.TestCase.runTest(TestCase.java:176)
>   at junit.framework.TestCase.runBare(TestCase.java:141)
>   at junit.framework.TestResult$1.protect(TestResult.java:122)
>   at junit.framework.TestResult.runProtected(TestResult.java:142)
>   at junit.framework.TestResult.run(TestResult.java:125)
>   at junit.framework.TestCase.run(TestCase.java:129)
>   at junit.framework.TestSuite.runTest(TestSuite.java:255)
>   at junit.framework.TestSuite.run(TestSuite.java:250)
>   at 
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
>   at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>   at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: Failed to parse:  null. Reason: Duplicated macro name 
> 'my_macro_1'
>   at 
> org.apache.pig.parser.QueryParserDriver.makeMacroDef(QueryParserDriver.java:406)
>   at 
> org.apache.pig.parser.QueryParserDriver.expandMacro(QueryParserDriver.java:277)
>   at 
> org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:178)
>   at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1599)
>   ... 30 more
>  
> Pig script which is failing :
> {code:title=test.pig|borderStyle=solid}
> DEFINE my_macro_1 (QUERY, A) RETURNS C {
> $C = ORDER $QUERY BY total DESC, $A;
> } ;
> data =  LOAD 'input' AS (query:CHARARRAY);
> queries_group = GROUP data BY query;
> queries_count = FOREACH queries_group GENERATE group AS query, COUNT(data) AS 
> total;
> queries_ordered = my_macro_1(queries_count, query);
> queries_limit = LIMIT queries_ordered 2;
> STORE queries_limit INTO 'output';
> {code}
> If I remove macro pigunit works fine. Even just defining macro without using 
> it results in parsing error.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (PIG-3114) Duplicated macro name error when using pigunit

2013-09-26 Thread Daniel Dai (JIRA)

 [ 
https://issues.apache.org/jira/browse/PIG-3114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Dai updated PIG-3114:


Attachment: PIG-3114-3.patch

Thanks [~rohini], attached new patch include the missing file.

> Duplicated macro name error when using pigunit
> --
>
> Key: PIG-3114
> URL: https://issues.apache.org/jira/browse/PIG-3114
> Project: Pig
>  Issue Type: Bug
>  Components: parser
>Affects Versions: 0.11
>Reporter: Chetan Nadgire
>Assignee: Chetan Nadgire
> Fix For: 0.12.0
>
> Attachments: PatchedPigTest.java, PIG-3114-2.patch, PIG-3114-3.patch, 
> PIG-3114.patch, PIG-3114.patch
>
>
> I'm using PigUnit to test a pig script within which a macro is defined.
> Pig runs fine on cluster but getting parsing error with pigunit.
> So I tried very basic pig script with macro and getting similar error.
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during 
> parsing.  null. Reason: Duplicated macro name 'my_macro_1'
>   at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1607)
>   at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1546)
>   at org.apache.pig.PigServer.registerQuery(PigServer.java:516)
>   at 
> org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:988)
>   at 
> org.apache.pig.pigunit.pig.GruntParser.processPig(GruntParser.java:61)
>   at 
> org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:412)
>   at 
> org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:194)
>   at 
> org.apache.pig.pigunit.pig.PigServer.registerScript(PigServer.java:56)
>   at org.apache.pig.pigunit.PigTest.registerScript(PigTest.java:160)
>   at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:231)
>   at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:261)
>   at FirstPigTest.MyPigTest.testTop2Queries(MyPigTest.java:32)
>   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 junit.framework.TestCase.runTest(TestCase.java:176)
>   at junit.framework.TestCase.runBare(TestCase.java:141)
>   at junit.framework.TestResult$1.protect(TestResult.java:122)
>   at junit.framework.TestResult.runProtected(TestResult.java:142)
>   at junit.framework.TestResult.run(TestResult.java:125)
>   at junit.framework.TestCase.run(TestCase.java:129)
>   at junit.framework.TestSuite.runTest(TestSuite.java:255)
>   at junit.framework.TestSuite.run(TestSuite.java:250)
>   at 
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
>   at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>   at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: Failed to parse:  null. Reason: Duplicated macro name 
> 'my_macro_1'
>   at 
> org.apache.pig.parser.QueryParserDriver.makeMacroDef(QueryParserDriver.java:406)
>   at 
> org.apache.pig.parser.QueryParserDriver.expandMacro(QueryParserDriver.java:277)
>   at 
> org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:178)
>   at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1599)
>   ... 30 more
>  
> Pig script which is failing :
> {code:title=test.pig|borderStyle=solid}
> DEFINE my_macro_1 (QUERY, A) RETURNS C {
> $C = ORDER $QUERY BY total DESC, $A;
> } ;
> data =  LOAD 'input' AS (query:CHARARRAY);
> queries_group = GROUP data BY query;
> queries_count = FOREACH queries_group GENERATE group AS query, COUNT(data) AS 
> total;
> queries_ordered = my_macro_1(queries_count, query);
> queries_limit = LIMIT queries_ordered 2;
> STORE queries_limit INTO 'output';
> {code}
> If I remove macro pigunit works fine. Even just defining macro without using 
> it results in parsing error.

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


[jira] [Updated] (PIG-3114) Duplicated macro name error when using pigunit

2013-09-26 Thread Daniel Dai (JIRA)

 [ 
https://issues.apache.org/jira/browse/PIG-3114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Dai updated PIG-3114:


Attachment: PIG-3114-2.patch

The issue is script is accidentally registered twice in some cases. Attach a 
patch.

> Duplicated macro name error when using pigunit
> --
>
> Key: PIG-3114
> URL: https://issues.apache.org/jira/browse/PIG-3114
> Project: Pig
>  Issue Type: Bug
>  Components: parser
>Affects Versions: 0.11
>Reporter: Chetan Nadgire
>Assignee: Chetan Nadgire
> Fix For: 0.12.0
>
> Attachments: PatchedPigTest.java, PIG-3114-2.patch, PIG-3114.patch, 
> PIG-3114.patch
>
>
> I'm using PigUnit to test a pig script within which a macro is defined.
> Pig runs fine on cluster but getting parsing error with pigunit.
> So I tried very basic pig script with macro and getting similar error.
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during 
> parsing.  null. Reason: Duplicated macro name 'my_macro_1'
>   at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1607)
>   at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1546)
>   at org.apache.pig.PigServer.registerQuery(PigServer.java:516)
>   at 
> org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:988)
>   at 
> org.apache.pig.pigunit.pig.GruntParser.processPig(GruntParser.java:61)
>   at 
> org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:412)
>   at 
> org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:194)
>   at 
> org.apache.pig.pigunit.pig.PigServer.registerScript(PigServer.java:56)
>   at org.apache.pig.pigunit.PigTest.registerScript(PigTest.java:160)
>   at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:231)
>   at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:261)
>   at FirstPigTest.MyPigTest.testTop2Queries(MyPigTest.java:32)
>   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 junit.framework.TestCase.runTest(TestCase.java:176)
>   at junit.framework.TestCase.runBare(TestCase.java:141)
>   at junit.framework.TestResult$1.protect(TestResult.java:122)
>   at junit.framework.TestResult.runProtected(TestResult.java:142)
>   at junit.framework.TestResult.run(TestResult.java:125)
>   at junit.framework.TestCase.run(TestCase.java:129)
>   at junit.framework.TestSuite.runTest(TestSuite.java:255)
>   at junit.framework.TestSuite.run(TestSuite.java:250)
>   at 
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
>   at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>   at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: Failed to parse:  null. Reason: Duplicated macro name 
> 'my_macro_1'
>   at 
> org.apache.pig.parser.QueryParserDriver.makeMacroDef(QueryParserDriver.java:406)
>   at 
> org.apache.pig.parser.QueryParserDriver.expandMacro(QueryParserDriver.java:277)
>   at 
> org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:178)
>   at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1599)
>   ... 30 more
>  
> Pig script which is failing :
> {code:title=test.pig|borderStyle=solid}
> DEFINE my_macro_1 (QUERY, A) RETURNS C {
> $C = ORDER $QUERY BY total DESC, $A;
> } ;
> data =  LOAD 'input' AS (query:CHARARRAY);
> queries_group = GROUP data BY query;
> queries_count = FOREACH queries_group GENERATE group AS query, COUNT(data) AS 
> total;
> queries_ordered = my_macro_1(queries_count, query);
> queries_limit = LIMIT queries_ordered 2;
> STORE queries_limit INTO 'output';
> {code}
> If I remove macro pigunit works fine. Even just defining macro without using 
> it results in parsing error.

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


[jira] [Updated] (PIG-3114) Duplicated macro name error when using pigunit

2013-07-24 Thread Sajid Raza (JIRA)

 [ 
https://issues.apache.org/jira/browse/PIG-3114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sajid Raza updated PIG-3114:


Attachment: PatchedPigTest.java

Temporary workaround in end-user code to get PigTest to work.

> Duplicated macro name error when using pigunit
> --
>
> Key: PIG-3114
> URL: https://issues.apache.org/jira/browse/PIG-3114
> Project: Pig
>  Issue Type: Bug
>  Components: parser
>Affects Versions: 0.11
>Reporter: Chetan Nadgire
>Assignee: Chetan Nadgire
> Fix For: 0.12
>
> Attachments: PatchedPigTest.java, PIG-3114.patch, PIG-3114.patch
>
>
> I'm using PigUnit to test a pig script within which a macro is defined.
> Pig runs fine on cluster but getting parsing error with pigunit.
> So I tried very basic pig script with macro and getting similar error.
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during 
> parsing.  null. Reason: Duplicated macro name 'my_macro_1'
>   at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1607)
>   at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1546)
>   at org.apache.pig.PigServer.registerQuery(PigServer.java:516)
>   at 
> org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:988)
>   at 
> org.apache.pig.pigunit.pig.GruntParser.processPig(GruntParser.java:61)
>   at 
> org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:412)
>   at 
> org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:194)
>   at 
> org.apache.pig.pigunit.pig.PigServer.registerScript(PigServer.java:56)
>   at org.apache.pig.pigunit.PigTest.registerScript(PigTest.java:160)
>   at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:231)
>   at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:261)
>   at FirstPigTest.MyPigTest.testTop2Queries(MyPigTest.java:32)
>   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 junit.framework.TestCase.runTest(TestCase.java:176)
>   at junit.framework.TestCase.runBare(TestCase.java:141)
>   at junit.framework.TestResult$1.protect(TestResult.java:122)
>   at junit.framework.TestResult.runProtected(TestResult.java:142)
>   at junit.framework.TestResult.run(TestResult.java:125)
>   at junit.framework.TestCase.run(TestCase.java:129)
>   at junit.framework.TestSuite.runTest(TestSuite.java:255)
>   at junit.framework.TestSuite.run(TestSuite.java:250)
>   at 
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
>   at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>   at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: Failed to parse:  null. Reason: Duplicated macro name 
> 'my_macro_1'
>   at 
> org.apache.pig.parser.QueryParserDriver.makeMacroDef(QueryParserDriver.java:406)
>   at 
> org.apache.pig.parser.QueryParserDriver.expandMacro(QueryParserDriver.java:277)
>   at 
> org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:178)
>   at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1599)
>   ... 30 more
>  
> Pig script which is failing :
> {code:title=test.pig|borderStyle=solid}
> DEFINE my_macro_1 (QUERY, A) RETURNS C {
> $C = ORDER $QUERY BY total DESC, $A;
> } ;
> data =  LOAD 'input' AS (query:CHARARRAY);
> queries_group = GROUP data BY query;
> queries_count = FOREACH queries_group GENERATE group AS query, COUNT(data) AS 
> total;
> queries_ordered = my_macro_1(queries_count, query);
> queries_limit = LIMIT queries_ordered 2;
> STORE queries_limit INTO 'output';
> {code}
> If I remove macro pigunit works fine. Even just defining macro without using 
> it results in parsing error.

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


[jira] [Updated] (PIG-3114) Duplicated macro name error when using pigunit

2013-04-18 Thread Alan Gates (JIRA)

 [ 
https://issues.apache.org/jira/browse/PIG-3114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alan Gates updated PIG-3114:


Status: Open  (was: Patch Available)

Canceling patch pending agreement on how to address the issue.

> Duplicated macro name error when using pigunit
> --
>
> Key: PIG-3114
> URL: https://issues.apache.org/jira/browse/PIG-3114
> Project: Pig
>  Issue Type: Bug
>  Components: parser
>Affects Versions: 0.11
>Reporter: Chetan Nadgire
>Assignee: Chetan Nadgire
> Fix For: 0.12
>
> Attachments: PIG-3114.patch, PIG-3114.patch
>
>
> I'm using PigUnit to test a pig script within which a macro is defined.
> Pig runs fine on cluster but getting parsing error with pigunit.
> So I tried very basic pig script with macro and getting similar error.
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during 
> parsing.  null. Reason: Duplicated macro name 'my_macro_1'
>   at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1607)
>   at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1546)
>   at org.apache.pig.PigServer.registerQuery(PigServer.java:516)
>   at 
> org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:988)
>   at 
> org.apache.pig.pigunit.pig.GruntParser.processPig(GruntParser.java:61)
>   at 
> org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:412)
>   at 
> org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:194)
>   at 
> org.apache.pig.pigunit.pig.PigServer.registerScript(PigServer.java:56)
>   at org.apache.pig.pigunit.PigTest.registerScript(PigTest.java:160)
>   at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:231)
>   at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:261)
>   at FirstPigTest.MyPigTest.testTop2Queries(MyPigTest.java:32)
>   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 junit.framework.TestCase.runTest(TestCase.java:176)
>   at junit.framework.TestCase.runBare(TestCase.java:141)
>   at junit.framework.TestResult$1.protect(TestResult.java:122)
>   at junit.framework.TestResult.runProtected(TestResult.java:142)
>   at junit.framework.TestResult.run(TestResult.java:125)
>   at junit.framework.TestCase.run(TestCase.java:129)
>   at junit.framework.TestSuite.runTest(TestSuite.java:255)
>   at junit.framework.TestSuite.run(TestSuite.java:250)
>   at 
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
>   at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>   at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: Failed to parse:  null. Reason: Duplicated macro name 
> 'my_macro_1'
>   at 
> org.apache.pig.parser.QueryParserDriver.makeMacroDef(QueryParserDriver.java:406)
>   at 
> org.apache.pig.parser.QueryParserDriver.expandMacro(QueryParserDriver.java:277)
>   at 
> org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:178)
>   at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1599)
>   ... 30 more
>  
> Pig script which is failing :
> {code:title=test.pig|borderStyle=solid}
> DEFINE my_macro_1 (QUERY, A) RETURNS C {
> $C = ORDER $QUERY BY total DESC, $A;
> } ;
> data =  LOAD 'input' AS (query:CHARARRAY);
> queries_group = GROUP data BY query;
> queries_count = FOREACH queries_group GENERATE group AS query, COUNT(data) AS 
> total;
> queries_ordered = my_macro_1(queries_count, query);
> queries_limit = LIMIT queries_ordered 2;
> STORE queries_limit INTO 'output';
> {code}
> If I remove macro pigunit works fine. Even just defining macro without using 
> it results in parsing error.

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


[jira] [Updated] (PIG-3114) Duplicated macro name error when using pigunit

2013-01-22 Thread Daniel Dai (JIRA)

 [ 
https://issues.apache.org/jira/browse/PIG-3114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Dai updated PIG-3114:


Assignee: Chetan Nadgire

> Duplicated macro name error when using pigunit
> --
>
> Key: PIG-3114
> URL: https://issues.apache.org/jira/browse/PIG-3114
> Project: Pig
>  Issue Type: Bug
>  Components: parser
>Affects Versions: 0.11
>Reporter: Chetan Nadgire
>Assignee: Chetan Nadgire
> Fix For: 0.12
>
> Attachments: PIG-3114.patch, PIG-3114.patch
>
>
> I'm using PigUnit to test a pig script within which a macro is defined.
> Pig runs fine on cluster but getting parsing error with pigunit.
> So I tried very basic pig script with macro and getting similar error.
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during 
> parsing.  null. Reason: Duplicated macro name 'my_macro_1'
>   at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1607)
>   at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1546)
>   at org.apache.pig.PigServer.registerQuery(PigServer.java:516)
>   at 
> org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:988)
>   at 
> org.apache.pig.pigunit.pig.GruntParser.processPig(GruntParser.java:61)
>   at 
> org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:412)
>   at 
> org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:194)
>   at 
> org.apache.pig.pigunit.pig.PigServer.registerScript(PigServer.java:56)
>   at org.apache.pig.pigunit.PigTest.registerScript(PigTest.java:160)
>   at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:231)
>   at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:261)
>   at FirstPigTest.MyPigTest.testTop2Queries(MyPigTest.java:32)
>   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 junit.framework.TestCase.runTest(TestCase.java:176)
>   at junit.framework.TestCase.runBare(TestCase.java:141)
>   at junit.framework.TestResult$1.protect(TestResult.java:122)
>   at junit.framework.TestResult.runProtected(TestResult.java:142)
>   at junit.framework.TestResult.run(TestResult.java:125)
>   at junit.framework.TestCase.run(TestCase.java:129)
>   at junit.framework.TestSuite.runTest(TestSuite.java:255)
>   at junit.framework.TestSuite.run(TestSuite.java:250)
>   at 
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
>   at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>   at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: Failed to parse:  null. Reason: Duplicated macro name 
> 'my_macro_1'
>   at 
> org.apache.pig.parser.QueryParserDriver.makeMacroDef(QueryParserDriver.java:406)
>   at 
> org.apache.pig.parser.QueryParserDriver.expandMacro(QueryParserDriver.java:277)
>   at 
> org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:178)
>   at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1599)
>   ... 30 more
>  
> Pig script which is failing :
> {code:title=test.pig|borderStyle=solid}
> DEFINE my_macro_1 (QUERY, A) RETURNS C {
> $C = ORDER $QUERY BY total DESC, $A;
> } ;
> data =  LOAD 'input' AS (query:CHARARRAY);
> queries_group = GROUP data BY query;
> queries_count = FOREACH queries_group GENERATE group AS query, COUNT(data) AS 
> total;
> queries_ordered = my_macro_1(queries_count, query);
> queries_limit = LIMIT queries_ordered 2;
> STORE queries_limit INTO 'output';
> {code}
> If I remove macro pigunit works fine. Even just defining macro without using 
> it results in parsing error.

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


[jira] [Updated] (PIG-3114) Duplicated macro name error when using pigunit

2013-01-18 Thread Bill Graham (JIRA)

 [ 
https://issues.apache.org/jira/browse/PIG-3114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Bill Graham updated PIG-3114:
-

Fix Version/s: (was: 0.11)
   0.12

> Duplicated macro name error when using pigunit
> --
>
> Key: PIG-3114
> URL: https://issues.apache.org/jira/browse/PIG-3114
> Project: Pig
>  Issue Type: Bug
>  Components: parser
>Affects Versions: 0.11
>Reporter: Chetan Nadgire
> Fix For: 0.12
>
> Attachments: PIG-3114.patch, PIG-3114.patch
>
>
> I'm using PigUnit to test a pig script within which a macro is defined.
> Pig runs fine on cluster but getting parsing error with pigunit.
> So I tried very basic pig script with macro and getting similar error.
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during 
> parsing.  null. Reason: Duplicated macro name 'my_macro_1'
>   at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1607)
>   at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1546)
>   at org.apache.pig.PigServer.registerQuery(PigServer.java:516)
>   at 
> org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:988)
>   at 
> org.apache.pig.pigunit.pig.GruntParser.processPig(GruntParser.java:61)
>   at 
> org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:412)
>   at 
> org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:194)
>   at 
> org.apache.pig.pigunit.pig.PigServer.registerScript(PigServer.java:56)
>   at org.apache.pig.pigunit.PigTest.registerScript(PigTest.java:160)
>   at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:231)
>   at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:261)
>   at FirstPigTest.MyPigTest.testTop2Queries(MyPigTest.java:32)
>   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 junit.framework.TestCase.runTest(TestCase.java:176)
>   at junit.framework.TestCase.runBare(TestCase.java:141)
>   at junit.framework.TestResult$1.protect(TestResult.java:122)
>   at junit.framework.TestResult.runProtected(TestResult.java:142)
>   at junit.framework.TestResult.run(TestResult.java:125)
>   at junit.framework.TestCase.run(TestCase.java:129)
>   at junit.framework.TestSuite.runTest(TestSuite.java:255)
>   at junit.framework.TestSuite.run(TestSuite.java:250)
>   at 
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
>   at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>   at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: Failed to parse:  null. Reason: Duplicated macro name 
> 'my_macro_1'
>   at 
> org.apache.pig.parser.QueryParserDriver.makeMacroDef(QueryParserDriver.java:406)
>   at 
> org.apache.pig.parser.QueryParserDriver.expandMacro(QueryParserDriver.java:277)
>   at 
> org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:178)
>   at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1599)
>   ... 30 more
>  
> Pig script which is failing :
> {code:title=test.pig|borderStyle=solid}
> DEFINE my_macro_1 (QUERY, A) RETURNS C {
> $C = ORDER $QUERY BY total DESC, $A;
> } ;
> data =  LOAD 'input' AS (query:CHARARRAY);
> queries_group = GROUP data BY query;
> queries_count = FOREACH queries_group GENERATE group AS query, COUNT(data) AS 
> total;
> queries_ordered = my_macro_1(queries_count, query);
> queries_limit = LIMIT queries_ordered 2;
> STORE queries_limit INTO 'output';
> {code}
> If I remove macro pigunit works fine. Even just defining macro without using 
> it results in parsing error.

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


[jira] [Updated] (PIG-3114) Duplicated macro name error when using pigunit

2013-01-15 Thread Chetan Nadgire (JIRA)

 [ 
https://issues.apache.org/jira/browse/PIG-3114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chetan Nadgire updated PIG-3114:


Fix Version/s: 0.11
Affects Version/s: 0.11
 Release Note: Clearing cache before calling 
PigServer::registerScript() to fix macro redefinition error.
   Status: Patch Available  (was: Open)

PigServer::registerScript() it called multiple times by PigTest for same query. 
PigServer::Graph::scriptCache is used to store query and since same PigServer 
is used for all calls, same query gets appended in scriptCache.
When this query is parse it errors out due to multiple definitions of macro.
Clearing cache before calling PigServer::registerScript() will fix macro 
redefinition error.

> Duplicated macro name error when using pigunit
> --
>
> Key: PIG-3114
> URL: https://issues.apache.org/jira/browse/PIG-3114
> Project: Pig
>  Issue Type: Bug
>  Components: parser
>Affects Versions: 0.11
>Reporter: Chetan Nadgire
> Fix For: 0.11
>
> Attachments: PIG-3114.patch, PIG-3114.patch
>
>
> I'm using PigUnit to test a pig script within which a macro is defined.
> Pig runs fine on cluster but getting parsing error with pigunit.
> So I tried very basic pig script with macro and getting similar error.
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during 
> parsing.  null. Reason: Duplicated macro name 'my_macro_1'
>   at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1607)
>   at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1546)
>   at org.apache.pig.PigServer.registerQuery(PigServer.java:516)
>   at 
> org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:988)
>   at 
> org.apache.pig.pigunit.pig.GruntParser.processPig(GruntParser.java:61)
>   at 
> org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:412)
>   at 
> org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:194)
>   at 
> org.apache.pig.pigunit.pig.PigServer.registerScript(PigServer.java:56)
>   at org.apache.pig.pigunit.PigTest.registerScript(PigTest.java:160)
>   at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:231)
>   at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:261)
>   at FirstPigTest.MyPigTest.testTop2Queries(MyPigTest.java:32)
>   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 junit.framework.TestCase.runTest(TestCase.java:176)
>   at junit.framework.TestCase.runBare(TestCase.java:141)
>   at junit.framework.TestResult$1.protect(TestResult.java:122)
>   at junit.framework.TestResult.runProtected(TestResult.java:142)
>   at junit.framework.TestResult.run(TestResult.java:125)
>   at junit.framework.TestCase.run(TestCase.java:129)
>   at junit.framework.TestSuite.runTest(TestSuite.java:255)
>   at junit.framework.TestSuite.run(TestSuite.java:250)
>   at 
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
>   at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>   at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: Failed to parse:  null. Reason: Duplicated macro name 
> 'my_macro_1'
>   at 
> org.apache.pig.parser.QueryParserDriver.makeMacroDef(QueryParserDriver.java:406)
>   at 
> org.apache.pig.parser.QueryParserDriver.expandMacro(QueryParserDriver.java:277)
>   at 
> org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:178)
>   at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1599)
>   ... 30 more
>  
> Pig script which is failing :
> {code:title=test.pig|borderStyle=solid}
> DEFINE my_macro_1 (QUERY, A) RETURNS C {
> $C = ORDER $QUERY BY total DESC, $A;
> } ;
> data =  LOAD 'input' AS (query:CHARARRAY);
> queries_group = GROUP data BY query;
> queries_count = FOREACH queries_group GENERATE group AS query, COUNT(data) AS 
> total;
> queries_ordered = my_macro_1(queries_count, query);
> queries_limit = LIMIT 

[jira] [Updated] (PIG-3114) Duplicated macro name error when using pigunit

2013-01-09 Thread Chetan Nadgire (JIRA)

 [ 
https://issues.apache.org/jira/browse/PIG-3114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chetan Nadgire updated PIG-3114:


Attachment: PIG-3114.patch

> Duplicated macro name error when using pigunit
> --
>
> Key: PIG-3114
> URL: https://issues.apache.org/jira/browse/PIG-3114
> Project: Pig
>  Issue Type: Bug
>  Components: parser
>Reporter: Chetan Nadgire
> Attachments: PIG-3114.patch, PIG-3114.patch
>
>
> I'm using PigUnit to test a pig script within which a macro is defined.
> Pig runs fine on cluster but getting parsing error with pigunit.
> So I tried very basic pig script with macro and getting similar error.
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during 
> parsing.  null. Reason: Duplicated macro name 'my_macro_1'
>   at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1607)
>   at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1546)
>   at org.apache.pig.PigServer.registerQuery(PigServer.java:516)
>   at 
> org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:988)
>   at 
> org.apache.pig.pigunit.pig.GruntParser.processPig(GruntParser.java:61)
>   at 
> org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:412)
>   at 
> org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:194)
>   at 
> org.apache.pig.pigunit.pig.PigServer.registerScript(PigServer.java:56)
>   at org.apache.pig.pigunit.PigTest.registerScript(PigTest.java:160)
>   at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:231)
>   at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:261)
>   at FirstPigTest.MyPigTest.testTop2Queries(MyPigTest.java:32)
>   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 junit.framework.TestCase.runTest(TestCase.java:176)
>   at junit.framework.TestCase.runBare(TestCase.java:141)
>   at junit.framework.TestResult$1.protect(TestResult.java:122)
>   at junit.framework.TestResult.runProtected(TestResult.java:142)
>   at junit.framework.TestResult.run(TestResult.java:125)
>   at junit.framework.TestCase.run(TestCase.java:129)
>   at junit.framework.TestSuite.runTest(TestSuite.java:255)
>   at junit.framework.TestSuite.run(TestSuite.java:250)
>   at 
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
>   at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>   at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: Failed to parse:  null. Reason: Duplicated macro name 
> 'my_macro_1'
>   at 
> org.apache.pig.parser.QueryParserDriver.makeMacroDef(QueryParserDriver.java:406)
>   at 
> org.apache.pig.parser.QueryParserDriver.expandMacro(QueryParserDriver.java:277)
>   at 
> org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:178)
>   at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1599)
>   ... 30 more
>  
> Pig script which is failing :
> {code:title=test.pig|borderStyle=solid}
> DEFINE my_macro_1 (QUERY, A) RETURNS C {
> $C = ORDER $QUERY BY total DESC, $A;
> } ;
> data =  LOAD 'input' AS (query:CHARARRAY);
> queries_group = GROUP data BY query;
> queries_count = FOREACH queries_group GENERATE group AS query, COUNT(data) AS 
> total;
> queries_ordered = my_macro_1(queries_count, query);
> queries_limit = LIMIT queries_ordered 2;
> STORE queries_limit INTO 'output';
> {code}
> If I remove macro pigunit works fine. Even just defining macro without using 
> it results in parsing error.

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


[jira] [Updated] (PIG-3114) Duplicated macro name error when using pigunit

2013-01-09 Thread Chetan Nadgire (JIRA)

 [ 
https://issues.apache.org/jira/browse/PIG-3114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chetan Nadgire updated PIG-3114:


Attachment: PIG-3114.patch

Added method in PigServer to clear scripCache.
Clearing cache before calling PigServer::registerScript() will fix macro 
redefinition error.

> Duplicated macro name error when using pigunit
> --
>
> Key: PIG-3114
> URL: https://issues.apache.org/jira/browse/PIG-3114
> Project: Pig
>  Issue Type: Bug
>  Components: parser
>Reporter: Chetan Nadgire
> Attachments: PIG-3114.patch
>
>
> I'm using PigUnit to test a pig script within which a macro is defined.
> Pig runs fine on cluster but getting parsing error with pigunit.
> So I tried very basic pig script with macro and getting similar error.
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during 
> parsing.  null. Reason: Duplicated macro name 'my_macro_1'
>   at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1607)
>   at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1546)
>   at org.apache.pig.PigServer.registerQuery(PigServer.java:516)
>   at 
> org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:988)
>   at 
> org.apache.pig.pigunit.pig.GruntParser.processPig(GruntParser.java:61)
>   at 
> org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:412)
>   at 
> org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:194)
>   at 
> org.apache.pig.pigunit.pig.PigServer.registerScript(PigServer.java:56)
>   at org.apache.pig.pigunit.PigTest.registerScript(PigTest.java:160)
>   at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:231)
>   at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:261)
>   at FirstPigTest.MyPigTest.testTop2Queries(MyPigTest.java:32)
>   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 junit.framework.TestCase.runTest(TestCase.java:176)
>   at junit.framework.TestCase.runBare(TestCase.java:141)
>   at junit.framework.TestResult$1.protect(TestResult.java:122)
>   at junit.framework.TestResult.runProtected(TestResult.java:142)
>   at junit.framework.TestResult.run(TestResult.java:125)
>   at junit.framework.TestCase.run(TestCase.java:129)
>   at junit.framework.TestSuite.runTest(TestSuite.java:255)
>   at junit.framework.TestSuite.run(TestSuite.java:250)
>   at 
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
>   at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>   at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>   at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: Failed to parse:  null. Reason: Duplicated macro name 
> 'my_macro_1'
>   at 
> org.apache.pig.parser.QueryParserDriver.makeMacroDef(QueryParserDriver.java:406)
>   at 
> org.apache.pig.parser.QueryParserDriver.expandMacro(QueryParserDriver.java:277)
>   at 
> org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:178)
>   at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1599)
>   ... 30 more
>  
> Pig script which is failing :
> {code:title=test.pig|borderStyle=solid}
> DEFINE my_macro_1 (QUERY, A) RETURNS C {
> $C = ORDER $QUERY BY total DESC, $A;
> } ;
> data =  LOAD 'input' AS (query:CHARARRAY);
> queries_group = GROUP data BY query;
> queries_count = FOREACH queries_group GENERATE group AS query, COUNT(data) AS 
> total;
> queries_ordered = my_macro_1(queries_count, query);
> queries_limit = LIMIT queries_ordered 2;
> STORE queries_limit INTO 'output';
> {code}
> If I remove macro pigunit works fine. Even just defining macro without using 
> it results in parsing error.

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


[jira] [Updated] (PIG-3114) Duplicated macro name error when using pigunit

2013-01-03 Thread Chetan Nadgire (JIRA)

 [ 
https://issues.apache.org/jira/browse/PIG-3114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chetan Nadgire updated PIG-3114:


Description: 
I'm using PigUnit to test a pig script within which a macro is defined.
Pig runs fine on cluster but getting parsing error with pigunit.
So I tried very basic pig script with macro and getting similar error.

org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during 
parsing.  null. Reason: Duplicated macro name 'my_macro_1'
at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1607)
at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1546)
at org.apache.pig.PigServer.registerQuery(PigServer.java:516)
at 
org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:988)
at 
org.apache.pig.pigunit.pig.GruntParser.processPig(GruntParser.java:61)
at 
org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:412)
at 
org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:194)
at 
org.apache.pig.pigunit.pig.PigServer.registerScript(PigServer.java:56)
at org.apache.pig.pigunit.PigTest.registerScript(PigTest.java:160)
at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:231)
at org.apache.pig.pigunit.PigTest.assertOutput(PigTest.java:261)
at FirstPigTest.MyPigTest.testTop2Queries(MyPigTest.java:32)
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 junit.framework.TestCase.runTest(TestCase.java:176)
at junit.framework.TestCase.runBare(TestCase.java:141)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at junit.framework.TestResult.run(TestResult.java:125)
at junit.framework.TestCase.run(TestCase.java:129)
at junit.framework.TestSuite.runTest(TestSuite.java:255)
at junit.framework.TestSuite.run(TestSuite.java:250)
at 
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: Failed to parse:  null. Reason: Duplicated macro name 
'my_macro_1'
at 
org.apache.pig.parser.QueryParserDriver.makeMacroDef(QueryParserDriver.java:406)
at 
org.apache.pig.parser.QueryParserDriver.expandMacro(QueryParserDriver.java:277)
at 
org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:178)
at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1599)
... 30 more

 
Pig script which is failing :


{code:title=test.pig|borderStyle=solid}
DEFINE my_macro_1 (QUERY, A) RETURNS C {
$C = ORDER $QUERY BY total DESC, $A;
} ;

data =  LOAD 'input' AS (query:CHARARRAY);

queries_group = GROUP data BY query;

queries_count = FOREACH queries_group GENERATE group AS query, COUNT(data) AS 
total;

queries_ordered = my_macro_1(queries_count, query);

queries_limit = LIMIT queries_ordered 2;

STORE queries_limit INTO 'output';
{code}


If I remove macro pigunit works fine. Even just defining macro without using it 
results in parsing error.




  was:
I'm using PigUnit to test a pig script within which a macro is defined.
Pig runs fine on cluster but getting parsing error with pigunit.
So I tried very basic pig script with macro and getting similar error.

org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during 
parsing.  null. Reason: Duplicated macro name 'my_macro_1'
at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1607)
at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1546)
at org.apache.pig.PigServer.registerQuery(PigServer.java:516)
at 
org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:988)
at 
org.apache.pig.pigunit.pig.GruntParser.processPig(GruntParser.java:61)
at 
org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:412)
at 
org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:194)
at 
org.a