[
https://issues.apache.org/jira/browse/PIG-100?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Benjamin Francisoud updated PIG-100:
------------------------------------
Attachment: PIG-100-v01.patch
This wasn't related to the fact that I didn't provide the hadoop-site.xml
The test is checking how the parser handle pasing exception (which is great).
But the error message (a null pointer) can be improve to provide feedback to
the user why the parsing failed.
This patch add a better error handling and more important a better error
message when an alias is not find in the aliases list.
Modified QueryParser.jjt
Now the error message looks like:
{noformat}
org.apache.pig.impl.logicalLayer.parser.ParseException: Unable to find alias:
'A' - aliases: ''
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.Alias(QueryParser.java:484)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.NestedExpr(QueryParser.java:411)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.NestedExpr(QueryParser.java:417)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.GroupItem(QueryParser.java:1043)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.CogroupClause(QueryParser.java:996)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.BaseExpr(QueryParser.java:537)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.NestedExpr(QueryParser.java:423)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.ForEachClause(QueryParser.java:1364)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.BaseExpr(QueryParser.java:566)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.Expr(QueryParser.java:371)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.Parse(QueryParser.java:244)
at
org.apache.pig.impl.logicalLayer.LogicalPlanBuilder.parse(LogicalPlanBuilder.java:47)
at
org.apache.pig.test.TestLogicalPlanBuilder.buildPlan(TestLogicalPlanBuilder.java:544)
at
org.apache.pig.test.TestLogicalPlanBuilder.buildPlan(TestLogicalPlanBuilder.java:535)
at
org.apache.pig.test.TestLogicalPlanBuilder.testQueryFail1(TestLogicalPlanBuilder.java:133)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:228)
at junit.framework.TestSuite.run(TestSuite.java:223)
at
org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
{noformat}
> Tests: NullPointerException parser.QueryParser.Alias(QueryParser.java:471)
> --------------------------------------------------------------------------
>
> Key: PIG-100
> URL: https://issues.apache.org/jira/browse/PIG-100
> Project: Pig
> Issue Type: Bug
> Components: impl
> Affects Versions: 0.1.0
> Reporter: Benjamin Francisoud
> Priority: Minor
> Attachments: PIG-100-tests.log, PIG-100-v01.patch
>
>
> I think the root problem was that I forget to specify the configuration using
> -Djunit.hadoop.conf=hadoop-site.xml while running the tests.
> But the error could be clearer...
> The logs are big so I will provide them in a separate file...
> But the core problem is:
> {noformat}
> [junit] java.lang.NullPointerException
> [junit] at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.Alias(QueryParser.java:471)
> [junit] at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.NestedExpr(QueryParser.java:411)
> [junit] at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.NestedExpr(QueryParser.java:417)
> [junit] at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.GroupItem(QueryParser.java:1027)
> ...
> [junit] org.apache.pig.impl.logicalLayer.parser.ParseException:
> Encountered "group" at line 1, column 9.
> [junit] Was expecting one of:
> [junit] <IDENTIFIER> ...
> [junit] "(" ...
> [junit]
> [junit] at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.generateParseException(QueryParser.java:4142)
> ...
> [junit] org.apache.pig.impl.logicalLayer.parser.ParseException:
> Encountered "generate" at line 1, column 1.
> [junit] Was expecting one of:
> [junit] "load" ...
> [junit] "filter" ...
> {noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.