Created
July 2, 2014 06:00
-
-
Save mwinkle/ac9dbb152a1e10e06c16 to your computer and use it in GitHub Desktop.
HDInsight Hive with Groovy inline UDF's
This file contains hidden or 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
set hive.aux.jars.path=file:///c:/apps/dist/hive-0.13.0.2.1.3.0-1887/lib/groovy-all-2.1.6.jar | |
COMPILE `import org.apache.hadoop.hive.ql.exec.UDF \; | |
public class Pyth extends UDF { | |
public double evaluate(double a, double b){ | |
return Math.sqrt((a*a) + (b*b)) \; | |
} | |
} ` AS GROOVY NAMED Pyth.groovy; | |
CREATE TEMPORARY FUNCTION Pyth as 'Pyth'; | |
SELECT country, Pyth(3,4) from hivesampletable limit 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment