Re: UDF to calculate Average of whole dataset

2013-03-05 Thread inelu nagamallikarjuna
Hi, I am providing sample UDF and how to use it in pig script. *JAVA CLASS: package myudf.udf.upper; public class UPPER extends EvalFunc { logic to convert all the tokens into Upper case ones. }* *input data:* naga siva ravi *Pig Script* *-- Always use absolute path of the udf jar lo

Re: UDF to calculate Average of whole dataset

2013-03-05 Thread inelu nagamallikarjuna
Hi, Use the fully qualified class name like org.apache.udf.myudf.udfName in the pig script while using udf. Otherwise use only udf name in the script and while running use like pig - Dudf.import.list=org.apache.udf.myudf.evaluation.string scriptname.pig Thanks Nagamallikarjuna On Wed, Mar 6, 20

Re: UDF to calculate Average of whole dataset

2013-03-05 Thread Preeti Gupta
Nope. It does not work 2013-03-05 13:22:28,768 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1070: Could not resolve myudf.CalculateAvg using imports: [, org.apache.pig.builtin., org.apache.pig.impl.builtin.] Details at logfile: /Users/PreetiGupta/Documents/CMPS290S/project/pig_13625185

Re: UDF to calculate Average of whole dataset

2013-03-05 Thread pablomar
did you try with {jarFileName}.{FunctionName} ? example: myudfs.CalculateAvg ? On Tue, Mar 5, 2013 at 4:04 PM, Preeti Gupta wrote: > I kept the code in myudfs.jar and my pig script is point to it using > register command but the script is not able to find CalculateAvg function. > I don't have an

Re: UDF to calculate Average of whole dataset

2013-03-05 Thread Preeti Gupta
I kept the code in myudfs.jar and my pig script is point to it using register command but the script is not able to find CalculateAvg function. I don't have any packages defined in the java file and the jar is my current directory. On Mar 5, 2013, at 3:17 AM, Jonathan Coveney wrote: > dividen

Re: UDF to calculate Average of whole dataset

2013-03-05 Thread Jonathan Coveney
dividends = load 'try.txt' a = foreach dividends generate FLATTEN(TOBAG(*)); b = foreach (group a all) generate CalculateAvg($1); I think that should work 2013/3/5 pablomar > what is the error ? > function not found or something like that ? > > what about this ? > avg = generate myudfs.C

Re: UDF to calculate Average of whole dataset

2013-03-04 Thread pablomar
what is the error ? function not found or something like that ? what about this ? avg = generate myudfs.CalculateAvg(dividends); On Mon, Mar 4, 2013 at 4:56 PM, Preeti Gupta wrote: > Hello All, > > I have dataset like > > 0, 10.1, 20.1, 30, 40, > 50, 60, 70, 80.1, 1, > 2, 3, 4, 5, 6,

UDF to calculate Average of whole dataset

2013-03-04 Thread Preeti Gupta
Hello All, I have dataset like 0, 10.1, 20.1, 30, 40, 50, 60, 70, 80.1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 56, 6, 7, 8, 9, 9, 9, 9, 12, 1, 3, 14, 1, 5, 6, 7, 8, 8, 9, 12 So basically comma separated values. But I want to consider this as one