Hive Cli compile

hive> compile `import org.apache.hadoop.hive.ql.exec.UDF \;
    > public class ToUpper extends UDF {
    >   public String evaluate(String str){
    >     return str.toUpperCase() \;
    >   }
    > } ` AS GROOVY NAMED Pyth.groovy;
Added [/tmp/1_1437662954473.jar] to class path
Added resources: [/tmp/1_1437662954473.jar]
hive> CREATE TEMPORARY FUNCTION upper as 'ToUpper';
OK
Time taken: 0.067 seconds
hive> SELECT upper(name) FROM t_user limit 10;
OK
C4CA4238A0B923820DCC509A6F75849B
C20AD4D76FE97759AA27A0C99BFF6710
202CB962AC59075B964B07152D234B70
81DC9BDB52D04DC20036DBD8313ED055
827CCB0EEA8A706C4C34A16891F84E7B
E10ADC3949BA59ABBE56E057F20F883E
FCEA920F7412B5DA7BE0CF42B8C93759
25D55AD283AA400AF464C76D713C07AD
25F9E794323B453885F5181F1B624D0B
432F45B44C432414D2F97DF0E5743818
Time taken: 0.372 seconds, Fetched: 10 row(s)
hive>

你可能感兴趣的:(hive,groovy,udf)