Question

If I execute

hive -f <my_sql_script>

to do some stuff in which i first add some resources i need like:-

add jar my.jar;
add file myfile;
// create function and execute query using that function

This works fine when i execute the whole script from outside(not entering hive using hive command). But when entering the hive interpreter and i try to execute my query using the function Ii created is doesn't find the function. So i have to again add jar and files in the hive terminal i entered using hive command. Then it works.

So my question here is that is there a new session of hive being opened? As the resources added by me from outside hive are lost?

In case of MapR and Cloudera this was not the case. I added the resources from outside using hive -f and after entering hive also i was able to execute my query using the function i created in the script. So why such behavior in Hortonworks?

Was it helpful?

Solution

I have been using Hortonworks, and you need to add the file/jar within the same session - as you have discovered.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top