Return-Path: Delivered-To: apmail-incubator-pig-dev-archive@locus.apache.org Received: (qmail 31629 invoked from network); 18 Jun 2008 16:39:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Jun 2008 16:39:36 -0000 Received: (qmail 95342 invoked by uid 500); 18 Jun 2008 16:39:38 -0000 Delivered-To: apmail-incubator-pig-dev-archive@incubator.apache.org Received: (qmail 95318 invoked by uid 500); 18 Jun 2008 16:39:38 -0000 Mailing-List: contact pig-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: pig-dev@incubator.apache.org Delivered-To: mailing list pig-dev@incubator.apache.org Received: (qmail 95279 invoked by uid 99); 18 Jun 2008 16:39:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Jun 2008 09:39:38 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Jun 2008 16:38:56 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 5D562234C144 for ; Wed, 18 Jun 2008 09:38:45 -0700 (PDT) Message-ID: <1147217472.1213807125367.JavaMail.jira@brutus> Date: Wed, 18 Jun 2008 09:38:45 -0700 (PDT) From: "Shravan Matthur Narayanamurthy (JIRA)" To: pig-dev@incubator.apache.org Subject: [jira] Commented: (PIG-255) Calling non default constructor of Final class from Main class in UDF In-Reply-To: <2101440928.1212649185071.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/PIG-255?page=3Dcom.atlassian.ji= ra.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1260600= 5#action_12606005 ]=20 Shravan Matthur Narayanamurthy commented on PIG-255: ---------------------------------------------------- It was our mistake. We had not intended to change resolveClassName. We will= be uploading a new patch.=20 {noformat} public Class getClassForAlias(String alias) throws IOException{ String className, funcSpec =3D null; if (definedFunctions !=3D null) { funcSpec =3D definedFunctions.get(alias); } if (funcSpec !=3D null) { className =3D getClassNameFromSpec(funcSpec); }else{ className =3D alias; } return resolveClassName(className); } {noformat} The fix we are proposing is here. When funcSpec=3D=3Dnull, we set className= =3Dalias. But in our case when the final function uses the arg version , th= e alias is not just a class name but a funcSpec. So the if block should be= =20 {noformat} if (funcSpec !=3D null) { className =3D getClassNameFromSpec(funcSpec); }else{ className =3D getClassNameFromSpec(alias); } {noformat} Will be submitting a new patch with this. > 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, 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. T= he problem is once the func is defined to use a non default constructor whi= ch takes in names of the variables, we have no way of transmitting this inf= ormation 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 =3D Covariance('Population', 'Height'); Then we would have the "Populat= ion' & 'Height' stored in the main class. A call to getFinal would return C= ovariance$Final("Population", "Height") instead of just Covariance$Final. I= guess this is the right way to go. However, pig has a problem with this. T= he resolveClassName method doesn't think of its args as specs and assumes t= hem 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 iss= ue with pig and we need to resolve it by clipping the args before doing a r= esolveClassName.=20 --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.