Created
October 31, 2012 08:09
-
-
Save xuwenhao/3985764 to your computer and use it in GitHub Desktop.
Pig Code to use UDF of accumulator interface
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
raw_data = load 'data' using ... as (model:chararray, ctr:double, clicks:int); | |
A = FOREACH raw_data GENERATE model as model, ctr as pctr, ((clicks > 0) ? 1 : 0) as clicked; | |
B = GROUP A by model; | |
C = FOREACH B { | |
D = ORDER A by pctr asc; | |
GENERATE com.mediav.ml.AccurateAuc(D.clicked); | |
} | |
STORE C INTO 'xxxx'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment