Pig UDF in Java: Error 1070

I'm trying to build my first Pig UDF in Java and am having trouble calling the function when building with Eclipse (I have the pig 0.10.0 jar file in my class path). The source file is in /com/foo/bar/pig/IsInternal.java and the class file is placed in /bin/com/foo/bar/pig/IsInternal.class by Eclipse.

My code looks like this:

package com.foo.bar.pig;

// ... imports ...

public class IsInternal extends FilterFunc {
    public Boolean exec(Tuple input) throws IOException {
        // ... code here ...
        return true; // or false

After I compile it, I run jar -cf PiggyBank.jar BiggyBank from just outside the project directory to package it all up into a JAR. When I run Pig, I try the following in the grunt shell:

REGISTER /full/path/to/PiggyBank.jar
DEFINE isInternal com.foo.bar.pig.IsInternal();

A = LOAD '/some/file/in/hdfs' USING PigStorage();
B = FILTER A BY isInternal($1);

At that point I get the following error:

ERROR 1070: Could not resolve com.foo.bar.pig.IsInternal using imports: [, org.apache.pig.builtin, org.apache.pig.impl.builtin.]

The Java code itself is fine (I've tested it), and I've tried playing around with different class paths in the DEFINE without any luck. I haven't found anything of help online. How would I fix this?


I'm a little queasy about the packaging into a .jar by hand. Can you try putting into an eclipse project and exporting from there?

Also, can you confirm the directory structure of the jar? It should be like this: PiggyBank.jar/com/foo/bar/pig/IsInternal.class

This error look like you not fix the class path path error for your UDF i was also have the same problem you in this link i explain how to fix above error . Hope it will help you .

Need Your Help

How to access facebook.yml credentials from anywhere in a Rails app?


In a Rails 3.2 app I have a facebook.yml, twitter.yml, etc containing relevant tokens for development, production, staging environments.

NSMutableArray sorted

iphone objective-c nsmutablearray

I have a question about sorting NSMutableArray. For example I have an NSMutableArray elements of which it NSArray.