i have a simple java file that adds a star to a word and prints the
result.(this is the simplest java program i could think of)
import java.util.*;
public class Star {
public static void main (String[] args) {
if (args.length == 1) {
addStar(args[0]);
}else
System.exit(1);
}
public static void addStar (String word) {
String str = "";
str += word + "*";
System.out.println(str);
}
}
How can i use pig to execute this java program? The answer i can come
up with on my own is converting method addStar to a UDF but i dont
know how to do it(please help). The documentation wasn't that helpful.
Re-wording the question: Lets say i have a file words.log that
contains a column of words (all of which i want to add star to). I
would like to use pig to pass each word in the log through the java
program above. How can i do this?
If i were to write a pig script, would it be like this?
myscript.pig
a = load 'words.log' as (word:chararray);
b = foreach a generate star(word);... (I dont know what to do, please help)
dump b;
ubuntu-user
ife