You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Cheolsoo Park (JIRA)" <ji...@apache.org> on 2012/09/10 09:24:08 UTC

[jira] [Commented] (PIG-2847) Error defining macro within pig script when using PigUnit

    [ https://issues.apache.org/jira/browse/PIG-2847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13451798#comment-13451798 ] 

Cheolsoo Park commented on PIG-2847:
------------------------------------

This looks like fixed by PIG-2866.
                
> Error defining macro within pig script when using PigUnit
> ---------------------------------------------------------
>
>                 Key: PIG-2847
>                 URL: https://issues.apache.org/jira/browse/PIG-2847
>             Project: Pig
>          Issue Type: Bug
>          Components: parser
>    Affects Versions: 0.11
>            Reporter: Matthew Hayes
>
> I'm using PigUnit to test a pig script within which a macro is defined.  When I run it I get the error below.
>    [testng] org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. Can not create a Path from a null string
>    [testng] 	at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1595)
>    [testng] 	at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1534)
>    [testng] 	at org.apache.pig.PigServer.registerQuery(PigServer.java:516)
>    [testng] 	at org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:990)
>    [testng] 	at org.apache.pig.pigunit.pig.GruntParser.processPig(GruntParser.java:61)
>    [testng] 	at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:412)
>    [testng] 	at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:193)
>    [testng] 	at org.apache.pig.pigunit.pig.PigServer.registerScript(PigServer.java:56)
>    [testng] 	at org.apache.pig.pigunit.PigTest.registerScript(PigTest.java:160)
>    [testng] 	at org.apache.pig.pigunit.PigTest.runScript(PigTest.java:170)
>    [testng] 	at datafu.test.pig.macros.MacrosTests.macrosTest(MacrosTests.java:32)
>    [testng] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>    [testng] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>    [testng] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>    [testng] 	at java.lang.reflect.Method.invoke(Method.java:597)
>    [testng] 	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
>    [testng] 	at org.testng.internal.Invoker.invokeMethod(Invoker.java:691)
>    [testng] 	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:883)
>    [testng] 	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1208)
>    [testng] 	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
>    [testng] 	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
>    [testng] 	at org.testng.TestRunner.privateRun(TestRunner.java:754)
>    [testng] 	at org.testng.TestRunner.run(TestRunner.java:614)
>    [testng] 	at org.testng.SuiteRunner.runTest(SuiteRunner.java:335)
>    [testng] 	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:330)
>    [testng] 	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292)
>    [testng] 	at org.testng.SuiteRunner.run(SuiteRunner.java:241)
>    [testng] 	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
>    [testng] 	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
>    [testng] 	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1169)
>    [testng] 	at org.testng.TestNG.runSuitesLocally(TestNG.java:1094)
>    [testng] 	at org.testng.TestNG.run(TestNG.java:1006)
>    [testng] 	at org.testng.TestNG.privateMain(TestNG.java:1316)
>    [testng] 	at org.testng.TestNG.main(TestNG.java:1280)
>    [testng] Caused by: java.lang.IllegalArgumentException: Can not create a Path from a null string
>    [testng] 	at org.apache.hadoop.fs.Path.checkPathArg(Path.java:78)
>    [testng] 	at org.apache.hadoop.fs.Path.<init>(Path.java:90)
>    [testng] 	at org.apache.pig.impl.io.FileLocalizer.fetchFilesInternal(FileLocalizer.java:766)
>    [testng] 	at org.apache.pig.impl.io.FileLocalizer.fetchFile(FileLocalizer.java:733)
>    [testng] 	at org.apache.pig.parser.QueryParserDriver.getMacroFile(QueryParserDriver.java:350)
>    [testng] 	at org.apache.pig.parser.QueryParserDriver.makeMacroDef(QueryParserDriver.java:411)
>    [testng] 	at org.apache.pig.parser.QueryParserDriver.expandMacro(QueryParserDriver.java:268)
>    [testng] 	at org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:169)
>    [testng] 	at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1587)
>    [testng] 	... 33 more
> The pig script below generates this error:
> {code}
> register $JAR_PATH
> DEFINE row_count(data) returns count {
>         grouped = GROUP $data ALL;
>         $count = FOREACH grouped GENERATE COUNT_STAR($data);
> };
> data = LOAD 'input' AS (key:INT);
> data2 = row_count(data);
> STORE data2 INTO 'output';
> {code}
> However the pig script below, where I've expanded the macro manually, does not have the error and passes:
> {code}
> register $JAR_PATH
> data = LOAD 'input' AS (key:INT);
> grouped = GROUP data ALL;
> data2 = FOREACH grouped GENERATE COUNT(data);
> STORE data2 INTO 'output';
> {code}

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