[ https://issues.apache.org/jira/browse/PIG-1303?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12860310#action_12860310 ]
hc busy commented on PIG-1303: ------------------------------ Hmm, okay, so let me shorten my problem. Basically the functions getInitial, getIntermed, and getFinal in my Algebraic class doesn't have access to the constructor parameters. The reason is this. in Java, the super() constructor can only be called as the very first thing that the deriving class's constructor does, so my udfs has constructors that look like this: {code} public ExtremalTupleByNthField(String fieldIndexString, String order) { super(); parameters = "('"+fieldIndexString+"','"+order+"'"; } @Override public String getInitial() { return HelperClass.class.getName()+parameters; } {code} But the problem is EvalFunc() constructor calls the child class's getInitial() to type check. When it does this, it finds that my getInitial() returns something in complete because the "parameters" member variable hasn't been initialized yet. This is a pretty mundane problem with java programs and the way to fix it is what I've submitted in the patch calling an overridden method in the super()'s constructor. I mean, I don't see any other way to do this, but I'd be willing to work on another implementation if you can suggest one? > unable to set outgoing format for > org.apache.pig.piggybank.evaluation.util.apachelogparser.DateExtractor > -------------------------------------------------------------------------------------------------------- > > Key: PIG-1303 > URL: https://issues.apache.org/jira/browse/PIG-1303 > Project: Pig > Issue Type: Bug > Affects Versions: 0.6.0 > Environment: pig 0.6.0 on a fedora linux machine, jdk 1.6 u11 > Reporter: Johannes Rußek > Assignee: Dmitriy V. Ryaboy > Attachments: TypeCheckingVisitor.java.diff > > > I'm unable to set the format of the outgoing date string in the constructor > as it's supposed to work. > The only way i could change the format was to change the default in the java > class and rebuild piggybank. > Apparently this has something to do with the way pig instantiates > DateExtractor, quoting a replier on the mailing list: > David Vrensk said: > I ran into the same problem a couple of weeks ago, and > played around with the code inserting some print/log statements. It turns > out that the arguments are only used in the initial constructor calls, when > the pig process is starting, but once pig reaches the point where it would > use the udf, it creates new DateExtractors without passing the arguments. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.