You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by "leiwangouc@gmail.com" <le...@gmail.com> on 2014/02/10 09:08:44 UTC

Unit test for Pig UDF using DistributedCache

Is there a common way of writing a Unit Test around a UDF that makes use of the Distributed Cache? ie UDF that implements the getCacheFiles() function.

Thanks,
Lei




leiwangouc@gmail.com

Re: Unit test for Pig UDF using DistributedCache

Posted by David LaBarbera <da...@localresponse.com>.
One approach is to separate your code from the pig wrapper. That way you 
only need to unit test your business logic.
An example would be something like

public class wrapperUdf extends EvalFunc {
  public Integer exec() {
   foo.exec()
  }

  public List<String> getCachedFiles {
  }
}

public class foo {
  public Integer exec() {
  }
}


You can write unit test just again foo and leave UDF testing to 
component/functional testing.

David

On 10 Feb 2014, at 3:08, leiwangouc@gmail.com wrote:

> Is there a common way of writing a Unit Test around a UDF that makes 
> use of the Distributed Cache? ie UDF that implements the 
> getCacheFiles() function.
>
> Thanks,
> Lei
>
>
>
>
> leiwangouc@gmail.com