Pig
  1. Pig
  2. PIG-255

Calling non default constructor of Final class from Main class in UDF

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.1.0
    • Component/s: None
    • Labels:
      None

      Description

      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.

      1. test.patch
        6 kB
        Ajay Garg
      2. cons.patch
        0.8 kB
        Ajay Garg
      3. new.patch
        0.5 kB
        Ajay Garg

        Activity

          People

          • Assignee:
            Ajay Garg
            Reporter:
            Ajay Garg
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development