You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Sam William <sa...@stumbleupon.com> on 2012/05/03 08:23:07 UTC
ENV variables from CLI
How can I read env variables from the CLI . The basic set command might not be enough for me.
Essentially this is what Im trying to do - create a .hiverc file under $HIVE_HOME/bin so as to to create UDFs for everyone in the company to access . I d like to create the .hiverc file with commands like
add jar ${JAR_LOC}/custom_hive_udfs.jar;
CREATE TEMPORARY function BlastIt as 'com.test.hive.udf.BlastIt';
Id prefer not to hardcode the location of the jar file. What are my options ? Generating the .hiverc file everytime there s a change can only a second-best option .
Sam William
sampd@stumbleupon.com
Re: ENV variables from CLI
Posted by Sam William <sa...@stumbleupon.com>.
Thanks guys, Adding the 'env:' in my 'add jar' works.
Sam
On May 3, 2012, at 7:35 AM, Edward Capriolo wrote:
> That is generally how you set hiveconf. Env variables can be accessed this way.
>
> hive> set x=${env:HOME};
> hive> set x;
> x=/home/edward
>
>
>
> On Thu, May 3, 2012 at 2:48 AM, Nitin Pawar <ni...@gmail.com> wrote:
>> if you are looking at having parameters from external world to hive shells
>> then i would recommend
>>
>> 1) define all your query set into a file
>> 2) when you execute the query like hive -f hive.hql -hiveconf
>> parameter1=`echo $env-value`
>> and then in the hive.hql file you can access this command line parameter
>> with '${hiveconf:parameter1}'
>>
>> ~Nitin
>>
>> On Thu, May 3, 2012 at 11:53 AM, Sam William <sa...@stumbleupon.com> wrote:
>>>
>>> How can I read env variables from the CLI . The basic set command might
>>> not be enough for me.
>>>
>>>
>>> Essentially this is what Im trying to do - create a .hiverc file under
>>> $HIVE_HOME/bin so as to to create UDFs for everyone in the company to
>>> access . I d like to create the .hiverc file with commands like
>>>
>>> add jar ${JAR_LOC}/custom_hive_udfs.jar;
>>> CREATE TEMPORARY function BlastIt as 'com.test.hive.udf.BlastIt';
>>>
>>> Id prefer not to hardcode the location of the jar file. What are my
>>> options ? Generating the .hiverc file everytime there s a change can only
>>> a second-best option .
>>>
>>>
>>> Sam William
>>> sampd@stumbleupon.com
>>>
>>>
>>>
>>
>>
>>
>> --
>> Nitin Pawar
>>
Sam William
sampd@stumbleupon.com
Re: ENV variables from CLI
Posted by Edward Capriolo <ed...@gmail.com>.
That is generally how you set hiveconf. Env variables can be accessed this way.
hive> set x=${env:HOME};
hive> set x;
x=/home/edward
On Thu, May 3, 2012 at 2:48 AM, Nitin Pawar <ni...@gmail.com> wrote:
> if you are looking at having parameters from external world to hive shells
> then i would recommend
>
> 1) define all your query set into a file
> 2) when you execute the query like hive -f hive.hql -hiveconf
> parameter1=`echo $env-value`
> and then in the hive.hql file you can access this command line parameter
> with '${hiveconf:parameter1}'
>
> ~Nitin
>
> On Thu, May 3, 2012 at 11:53 AM, Sam William <sa...@stumbleupon.com> wrote:
>>
>> How can I read env variables from the CLI . The basic set command might
>> not be enough for me.
>>
>>
>> Essentially this is what Im trying to do - create a .hiverc file under
>> $HIVE_HOME/bin so as to to create UDFs for everyone in the company to
>> access . I d like to create the .hiverc file with commands like
>>
>> add jar ${JAR_LOC}/custom_hive_udfs.jar;
>> CREATE TEMPORARY function BlastIt as 'com.test.hive.udf.BlastIt';
>>
>> Id prefer not to hardcode the location of the jar file. What are my
>> options ? Generating the .hiverc file everytime there s a change can only
>> a second-best option .
>>
>>
>> Sam William
>> sampd@stumbleupon.com
>>
>>
>>
>
>
>
> --
> Nitin Pawar
>
Re: ENV variables from CLI
Posted by Nitin Pawar <ni...@gmail.com>.
if you are looking at having parameters from external world to hive shells
then i would recommend
1) define all your query set into a file
2) when you execute the query like hive -f hive.hql -hiveconf
parameter1=`echo $env-value`
and then in the hive.hql file you can access this command line parameter
with '${hiveconf:parameter1}'
~Nitin
On Thu, May 3, 2012 at 11:53 AM, Sam William <sa...@stumbleupon.com> wrote:
> How can I read env variables from the CLI . The basic set command might
> not be enough for me.
>
>
> Essentially this is what Im trying to do - create a .hiverc file under
> $HIVE_HOME/bin so as to to create UDFs for everyone in the company to
> access . I d like to create the .hiverc file with commands like * *
> *
> *
> * add jar ${JAR_LOC}/custom_hive_udfs.jar; *
> * CREATE TEMPORARY function BlastIt as 'com.test.hive.udf.BlastIt';*
> *
> *
> Id prefer not to hardcode the location of the jar file. What are my
> options ? Generating the .hiverc file everytime there s a change can only
> a second-best option .
>
>
> Sam William
> sampd@stumbleupon.com
>
>
>
>
--
Nitin Pawar