Skip to content

Instantly share code, notes, and snippets.

@cstenac
Created February 19, 2013 09:01
Show Gist options
  • Save cstenac/4984195 to your computer and use it in GitHub Desktop.
Save cstenac/4984195 to your computer and use it in GitHub Desktop.
Simple Hive UDF (3)
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