Skip to content
This repository has been archived by the owner on Oct 8, 2019. It is now read-only.

Commit

Permalink
Modified to return null instead of throwing UDFArgumentException for a
Browse files Browse the repository at this point in the history
null argument
  • Loading branch information
myui committed May 19, 2015
1 parent 47bff80 commit 181b369
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/hivemall/ftvec/hashing/MurmurHash3UDF.java
Expand Up @@ -36,7 +36,7 @@ public IntWritable evaluate(String word) throws UDFArgumentException {
public IntWritable evaluate(String word, boolean rawValue) throws UDFArgumentException {
if(rawValue) {
if(word == null) {
throw new UDFArgumentException("argument must not be null");
return null;
}
return val(MurmurHash3.murmurhash3_x86_32(word, 0, word.length(), 0x9747b28c));
} else {
Expand All @@ -46,7 +46,7 @@ public IntWritable evaluate(String word, boolean rawValue) throws UDFArgumentExc

public IntWritable evaluate(String word, int numFeatures) throws UDFArgumentException {
if(word == null) {
throw new UDFArgumentException("argument must not be null");
return null;
}
int r = MurmurHash3.murmurhash3_x86_32(word, 0, word.length(), 0x9747b28c) % numFeatures;
if(r < 0) {
Expand All @@ -61,7 +61,7 @@ public IntWritable evaluate(List<String> words) throws UDFArgumentException {

public IntWritable evaluate(List<String> words, int numFeatures) throws UDFArgumentException {
if(words == null) {
throw new UDFArgumentException("argument must not be null");
return null;
}
final int size = words.size();
if(size == 0) {
Expand Down

0 comments on commit 181b369

Please sign in to comment.