This is based on http://phoenix-hbase.blogspot.com/2013/04/how-to-add-your-own-built-in-function.html