This repository has been archived by the owner on Oct 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 153
Create Hivemall UDFs as permanent functions
Makoto YUI edited this page Dec 11, 2015
·
7 revisions
Hive v0.13 or later supports permanent functions that live across sessions.
Permanent functions are useful when you are using Hive through Hiveserver or to avoid hivemall installation for each session.
Note: This feature is supported since hivemall-0.3 beta 3 or later.
First, put hivemall jar to HDFS as follows:
hadoop fs -mkdir -p /apps/hivemall
hadoop fs -put hivemall-with-dependencies.jar /apps/hivemall
The following is an auxiliary step to define functions for hivemall databases, not for the default database.
CREATE DATABASE IF NOT EXISTS hivemall;
USE hivemall;
Then, create permanent functions using define-all-as-permanent.hive, a DDL script to define permanent UDFs.
set hivevar:hivemall_jar=hdfs:///apps/hivemall/hivemall-with-dependencies.jar;
source /tmp/define-all-as-permanent.hive;
show functions "hivemall.*";
hivemall.adadelta
hivemall.adagrad
...
CAUTION: You need to specify "hivemall." prefix to call hivemall UDFs in your queries if UDFs are loaded into non-default scheme, in this case hivemall.