Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Beeline UDF

Beeline UDF

Explorer

Hi. I am using Cloudera psuedo mode installed on VB. I am unable to use UDF in beeline while it is working fine as Hive UDF. The error I am getting is :-

 

[cloudera@quickstart ~]$ beeline -u 'jdbc:hive2://localhost:10000' -f bee_udf.q
2016-09-25 17:59:27,777 WARN  [main] mapreduce.TableMapReduceUtil: The hbase-prefix-tree module jar containing PrefixTreeCodec is not present.  Continuing without it.
scan complete in 15ms
Connecting to jdbc:hive2://localhost:10000
Connected to: Apache Hive (version 1.1.0-cdh5.7.0)
Driver: Hive JDBC (version 1.1.0-cdh5.7.0)
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:hive2://localhost:10000> ADD JAR /priyanka/helloword.jar;
Error: Error while processing statement: /priyanka/helloword.jar does not exist (state=,code=1)

[cloudera@quickstart ~]$ hadoop fs -put helloword.jar /priyanka
put: `/priyanka/helloword.jar': File exists

 

My source code is :-

package com;

import org.apache.hadoop.hive.ql.exec.UDF;
import org.apache.hadoop.io.Text;

public class HiveUDF extends UDF {
    public Text evaluate (Text input)
    {
        return new Text("xxxx");
       
    }

}

My script file code is:-
ADD JAR /priyanka/helloword.jar;
USE TEMPORARY FUNCTION mask AS HiveUDF;
use glvc;
select mask(product),product,city from product;

2 REPLIES 2
Highlighted

Re: Beeline UDF

Contributor
The path used in the add jar command is actually a local path. This command was added back in the Hive CLI days.

With Beeline/HiveServer2 being used prominently. a better ways of doing this would be to use the hive.aux.jars.path configuration. Below is the documentation link on how to do this.
https://www.cloudera.com/documentation/enterprise/5-6-x/topics/cm_mc_hive_udf.html#concept_cst_vms_l...

Please let me know if you have additional questions. Thanks

Re: Beeline UDF

Explorer

Hi

 

I have already gone through this document earlier. The problem which I am facing is that I am using Virtual Box and Cloudera is running in my VB. So I am unable to open the cloudera Manager and do the settings using Cloudera Manager. Kindly advice me, what I can do in this case.

Thanks in advance