Created
February 19, 2013 09:01
-
-
Save cstenac/4984195 to your computer and use it in GitHub Desktop.
Simple Hive UDF (3)
This file contains 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
public class ArraySum extends UDF { | |
public double evaluate(List<Double> value) { | |
double sum = 0; | |
for (int i = 0; i < value.size(); i++) { | |
if (value.get(i) != null) { | |
sum += value.get(i); | |
} | |
} | |
return sum; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment