Created
December 23, 2014 15:21
-
-
Save tswann/27ef26f354b4dcf5028b to your computer and use it in GitHub Desktop.
Soundex UDF wrapper for Hive.
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
@Description(name = "soundex", | |
value = "_FUNC_(string) - Retrieves the Soundex code for a given string.", | |
extended = "Example:\n" | |
+ " SELECT _FUNC_(input_string) FROM src;") | |
public final class SoundexUDF extends UDF { | |
public Text evaluate(final Text text) { | |
if (text == null) { | |
return null; | |
} | |
String soundex = new Soundex().soundex(text.toString()); | |
return new Text(soundex); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment