Created 02-22-2016 06:47 PM
We are experiencing a problem when trying to add jar’s/files via hive view @ ambari. However when we perform the same commands via CLI it works.
Can anyone help me on this?
Created 02-22-2016 11:05 PM
the following syntax was tested on sandbox in Hive view, assuming I have a UDF JAR called HiveSimpleUdf-1.0-SNAPSHOT.jar with class name com.hortonworks.hive.SimpleUDFgetRegionUS,
# upload JAR file into /tmp/udfs on hdfs, using hdfs dfs -put command or Ambari files view SELECT "California" as State; CREATE TEMPORARY FUNCTION getRegionUS AS 'com.hortonworks.hive.SimpleUDFgetRegionUS' USING JAR 'hdfs:///tmp/udfs/HiveSimpleUdf-1.0-SNAPSHOT.jar'; LIST JARS; SELECT "California" as State, getRegionUS("California") as Region; DROP FUNCTION getRegionsUS; CREATE FUNCTION getRegionUS AS 'com.hortonworks.hive.SimpleUDFgetRegionUS' USING JAR 'hdfs:///tmp/udfs/HiveSimpleUdf-1.0-SNAPSHOT.jar'; LIST JARS; SELECT DISTINCT getRegionUS(split(user.userlocation, ",")[0]) FROM TWEETS;
Created 02-22-2016 11:05 PM
the following syntax was tested on sandbox in Hive view, assuming I have a UDF JAR called HiveSimpleUdf-1.0-SNAPSHOT.jar with class name com.hortonworks.hive.SimpleUDFgetRegionUS,
# upload JAR file into /tmp/udfs on hdfs, using hdfs dfs -put command or Ambari files view SELECT "California" as State; CREATE TEMPORARY FUNCTION getRegionUS AS 'com.hortonworks.hive.SimpleUDFgetRegionUS' USING JAR 'hdfs:///tmp/udfs/HiveSimpleUdf-1.0-SNAPSHOT.jar'; LIST JARS; SELECT "California" as State, getRegionUS("California") as Region; DROP FUNCTION getRegionsUS; CREATE FUNCTION getRegionUS AS 'com.hortonworks.hive.SimpleUDFgetRegionUS' USING JAR 'hdfs:///tmp/udfs/HiveSimpleUdf-1.0-SNAPSHOT.jar'; LIST JARS; SELECT DISTINCT getRegionUS(split(user.userlocation, ",")[0]) FROM TWEETS;
Created 02-23-2016 10:08 AM
many thanks 🙂 it worked perfectly for .jar
When we try to add a file for example a GeoIP2 Database it gives the following error "H110 Unable to submit statement. Error while processing statement: null [ERROR_STATUS]"
Created 02-23-2016 11:17 AM
I cannot test now but try the command below. I'm not sure all CLI commands work in Ambari view. Try any from https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Cli
source /path/filename;
Created 02-22-2016 11:21 PM
Hi @Cristina Lopes, you can add your jar and other files to HDFS using the Files view, then go back to the Hive view and write your Hive scripts refering to those files. If you have some specific problems please let us know.
Created 02-23-2016 10:18 AM
We have done the upload of both .jar and other file (a .dat file), for .jar worked for the other it gives the following error "H110 Unable to submit statement. Error while processing statement: null [ERROR_STATUS]"
Created on 08-08-2016 09:38 AM - edited 08-18-2019 05:42 AM
Hi,
I tried out adding the jars that are present in hdfs using the hive view as follows
add jar 'hdfs:///tmp/udfs/hive/esri-geometry-api.jar';
But I am getting this error
Error while compiling statement: FAILED: ParseException line 4:0 cannot recognize input near 'add' 'jar' ''hdfs:///tmp/udfs/hive/esri-geometry-api.jar'' [ERROR_STATUS
I also tried to add jar like
add jar /tmp/udfs/hive/esri-geometry-api.jar;
Still I get the same error.
I am not able to add these spatial jars that i need . Can you help me out in that regard?
the image below shows the jars in the path as shown.
Created 10-12-2016 06:37 PM
@Srinivas Santhanam I guess you would have figured out by now. For others, the problem with above query is quotes in hdfs path, try without quote like below
add jar hdfs:///tmp/udfs/hive/esri-geometry-api.jar