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

Ajay Garg updated PIG-255:
--------------------------

    Attachment: new.patch

Attaching the patch (new.patch) for the modification explained by Shravan. Btw 
following is the stack trace of the error  without patch.

java.io.IOException: Could not resolve 
org.apache.pig.builtin.COR$Final('a','b','c') using imports: [, 
org.apache.pig.builtin., org.apache.pig.builtin.Math., 
com.yahoo.pig.yst.sds.ULT., org.apache.pig.impl.builtin.]
        at 
org.apache.pig.impl.util.WrappedIOException.wrap(WrappedIOException.java:16)
        at org.apache.pig.impl.PigContext.resolveClassName(PigContext.java:428)
        at org.apache.pig.impl.PigContext.getClassForAlias(PigContext.java:513)
        at org.apache.pig.impl.util.JarManager.createJar(JarManager.java:109)
        at 
org.apache.pig.backend.hadoop.executionengine.mapreduceExec.MapReduceLauncher.launchPig(MapReduceLauncher.java:159)
        at 
org.apache.pig.backend.hadoop.executionengine.POMapreduce.open(POMapreduce.java:185)
        at 
org.apache.pig.backend.hadoop.executionengine.HExecutionEngine.execute(HExecutionEngine.java:275)
        at org.apache.pig.PigServer.optimizeAndRunQuery(PigServer.java:413)
        at org.apache.pig.PigServer.openIterator(PigServer.java:332)
        at 
org.apache.pig.tools.grunt.GruntParser.processDump(GruntParser.java:265)
        at 
org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:162)
        at 
org.apache.pig.tools.grunt.GruntParser.parseContOnError(GruntParser.java:73)
        at org.apache.pig.tools.grunt.Grunt.run(Grunt.java:54)
        at org.apache.pig.Main.main(Main.java:273)
Caused by: java.lang.ClassNotFoundException: Could not resolve 
org.apache.pig.builtin.COR$Final('a','b','c') using imports: [, 
org.apache.pig.builtin., org.apache.pig.builtin.Math., 
com.yahoo.pig.yst.sds.ULT., org.apache.pig.impl.builtin.]
        at org.apache.pig.impl.PigContext.resolveClassName(PigContext.java:427)



> Calling non default constructor of Final class from Main class in UDF
> ---------------------------------------------------------------------
>
>                 Key: PIG-255
>                 URL: https://issues.apache.org/jira/browse/PIG-255
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Ajay Garg
>            Priority: Minor
>         Attachments: cons.patch, new.patch, test.patch
>
>
> Pig supports the use of define to call a non default constructor. Making it 
> work across Algebraic functions is not possible with the current code. The 
> problem is once the func is defined to use a non default constructor which 
> takes in names of the variables, we have no way of transmitting this 
> information from the main class to the final class. We tried passing the func 
> spec through the call to getFinal(). That is, What ever names we get in the 
> main class we store it and when the getFinal method is called, instead of 
> just passing the name of the Final class we attach the string args received 
> by the main class to the name to construct a func spec. For ex. if define COV 
> = Covariance('Population', 'Height'); Then we would have the "Population' & 
> 'Height' stored in the main class. A call to getFinal would return 
> Covariance$Final("Population", "Height") instead of just Covariance$Final. I 
> guess this is the right way to go. However, pig has a problem with this. The 
> resolveClassName method doesn't think of its args as specs and assumes them 
> to be just names. So in createJar, when the func spec, 
> Covariance$Final("Population", "Height") is being resolved it fails. I think 
> this is an issue with pig and we need to resolve it by clipping the args 
> before doing a resolveClassName. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to