Does the script run if you launch it from the pig command line instead of via PigServer?
On Wed, Nov 16, 2011 at 3:01 PM, Charles Menguy <[email protected]> wrote: > Hi, > > We're trying to run a PIG script using the PigServer API in Java, but we're > having a couple issues. > > It seems to work well in most cases, but in our case we need to use Pig's > dynamic invokers. Basically this looks something like the following: > DEFINE isEmail InvokeForInt('com.company.pig.udf.Utils.isEmail', 'String'); > > We register the script using PigServer like below: > pigServer.registerScript(pigScript, params); > > The problem is that PigServer doesn't seem to like these dynamic invokers. > We get an error during the parsing of the script by PigServer. We've > checked and the classpath is fine, and the UDF is defined correctly with > the right signature. Any help or advice would be very much appreciated on > this. I have attached the stack trace below for more details. > > Thanks, > > Charles > > ======================== > > Caused by: org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: > Error during parsing. could not instantiate 'InvokeForInt' with arguments > '[com.company.pig.udf.Utils.isEmail, String]' > at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1618) > at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1562) > at org.apache.pig.PigServer.registerQuery(PigServer.java:534) > at org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:868) > at > org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:388) > at > org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:168) > at org.apache.pig.PigServer.registerScript(PigServer.java:619) > at org.apache.pig.PigServer.registerScript(PigServer.java:577) > at com.proclivitysystems.etl.job.PIGJobRunner.run(PIGJobRunner.java:96) > ... 2 more > Caused by: org.apache.pig.impl.logicalLayer.parser.ParseException: could > not instantiate 'InvokeForInt' with arguments > '[com.company.pig.udf.Utils.isEmail, String]' > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.EvalFuncSpec(QueryParser.java:5465) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.BaseEvalSpec(QueryParser.java:5291) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.UnaryExpr(QueryParser.java:5187) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.CastExpr(QueryParser.java:5133) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.MultiplicativeExpr(QueryParser.java:5042) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.AdditiveExpr(QueryParser.java:4968) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.InfixExpr(QueryParser.java:4934) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.PUnaryCond(QueryParser.java:2160) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.PAndCond(QueryParser.java:2096) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.POrCond(QueryParser.java:2040) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.PCond(QueryParser.java:2006) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.BinCond(QueryParser.java:5406) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.BaseEvalSpec(QueryParser.java:5300) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.UnaryExpr(QueryParser.java:5187) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.CastExpr(QueryParser.java:5133) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.MultiplicativeExpr(QueryParser.java:5042) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.AdditiveExpr(QueryParser.java:4968) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.InfixExpr(QueryParser.java:4934) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.NestedCommand(QueryParser.java:4117) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.NestedBlock(QueryParser.java:4045) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.ForEachClause(QueryParser.java:3433) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.BaseExpr(QueryParser.java:1464) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.Expr(QueryParser.java:1013) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.Parse(QueryParser.java:800) > at > org.apache.pig.impl.logicalLayer.LogicalPlanBuilder.parse(LogicalPlanBuilder.java:63) > at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1612) > ... 10 more > Caused by: java.lang.RuntimeException: could not instantiate 'InvokeForInt' > with arguments '[com.company.pig.udf.Utils.isEmail, String]' > at > org.apache.pig.impl.PigContext.instantiateFuncFromSpec(PigContext.java:502) > at > org.apache.pig.impl.PigContext.instantiateFuncFromAlias(PigContext.java:529) > at > org.apache.pig.impl.logicalLayer.parser.QueryParser.EvalFuncSpec(QueryParser.java:5462) > ... 35 more > Caused by: java.lang.reflect.InvocationTargetException > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > at > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) > at > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > at java.lang.reflect.Constructor.newInstance(Constructor.java:532) > at > org.apache.pig.impl.PigContext.instantiateFuncFromSpec(PigContext.java:470) > ... 37 more >
