Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

not able to run hplsql function via cli

avatar
Expert Contributor

Hi,

I am trying to create hplsql function using details present in http://www.hplsql.org/udf.

However when i am trying to execute it , it throws error.

/home/devRht/hplsql/hplsql-0.3.17/hplsql.jar does not exist

However i can see that jar name is hplsql-0.3.17.jar which is present in above path. So why is it not picking up correct name?

I have my hplsql file also configured same way.

export PATH=$PATH:/home/devRht/hplsql/hplsql-0.3.17/

SCRIPTPATH=${0%/*} java -cp $SCRIPTPATH:$HADOOP_CLASSPATH:$SCRIPTPATH/hplsql-0.3.17.jar:$SCRIPTPATH/antlr-runtime-4.5.jar $HADOOP_OPTS org.apache.hive.hplsql.Hplsql "$@ "

what is the issue i am not able to understand ?

1 ACCEPTED SOLUTION

avatar
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login
8 REPLIES 8

avatar
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login

avatar
Expert Contributor

hi Sindhu,

Thanks for the reply.

I tried to change as per your suggestion :

java -cp /home/devRht/hplsql/hplsql-0.3.17/hplsql-0.3.17.jar:/home/devRht/hplsql/hplsql-0.3.17/antlr-runtime-4.5.jar:$HADOOP_OPTS org.apache.hive.hpl sql.Hplsql "$@"

but now its showing below error

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException at org.apache.hive.hplsql.Exec.<init>(Exec.java:87) at org.apache.hive.hplsql.Hplsql.main(Hplsql.java:23) Caused by: java.lang.ClassNotFoundException: org.apache.commons.cli.ParseException at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 2 more

thanks,

Rishit Shah

avatar
Expert Contributor

Hi Sindhu,

i could solve it with this:

java -cp $SCRIPTPATH:$HADOOP_CLASSPATH:/home/devRht/hplsql/hplsql-0.3.17/hplsql-0.3.17.jar:/home/devRht/hplsql/hplsql-0.3.17/antlr-runtime-4.5.jar $H ADOOP_OPTS org.apache.hive.hplsql.Hplsql "$@"

avatar
Expert Contributor

Hi Sindhu,

the above just resolved the issue for normal function.

Now when i am trying to run frunction for hive as a UDF hplsql, it throws error.

Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: Error evaluating hplsql

Below steps followed:

add jar /usr/hdp/current/hive-server2-hive2/lib/antlr4-runtime-4.5.jar;

add jar /usr/hdp/2.6.0.3-8/hive2/lib/hive-hplsql-2.1.0.2.6.0.3-8.jar;

add jar /home/devRht/hplsql/hplsql-0.3.17/hplsql-0.3.17.jar;

CREATE TEMPORARY FUNCTION hplsql AS 'org.apache.hive.hplsql.Udf';

add file /home/devRht/hplsql/hplsql-0.3.17/hplsql-site.xml;

add file /home/devRht/hplsql/hplsql-0.3.17/hplsql;

thanks,

Rishit Shah

avatar

@Rishit shah Can you open a new question for this issue? This will help community with better search on issues.

avatar
Expert Contributor

Hi @Pardeep

i think this is not a seperate issue but it is on same line.

the above resolution just solved a partial query.

Hope this is fine.

Let me know your input for resolving my query.

thanks,

Rishit Shah

avatar

@Rishit shah

Does the query fail while running select query? Seems to be related to HIVE-13877.

avatar
Expert Contributor

Yes it fails with select queries.

i checked above that but i dont know how to make us of the patch?

thanks,

Rishit Shah